简体   繁体   English

Pygame中的非平铺地图

[英]Non-Tiled Maps in Pygame

I'm quite green in Pygame, but after stepping thorugh the tutorials and some playing with existing examples I think I should start up something. 我在Pygame中非常环保,但是在逐步学习教程和一些现有示例之后,我认为我应该开始做一些事情。 Since I'm a strategygamer I thought to give it a try. 由于我是一名策略游戏玩家,因此我想尝试一下。 So.. 所以..

To create a simple "Risk" like map to send my hordes of armies around on, what would you advice to be the best? 要创建一个简单的“风险”式地图来派出我的大军,您认为最好的是什么? Is there somekind of "clickable" graphic-file to use or should I simply draw rects in pygame and detect clicks on those? 是否有某种“可点击的”图形文件可使用,还是我应该在pygame中简单地绘制矩形并检测对它们的点击?

Best regards, 最好的祝福,

Matias 马蒂亚斯

I think the best way would be to use an image and utilize the color of the images to find out which country is being hovered/clicked. 我认为最好的方法是使用图像并利用图像的颜色来找出要悬停/单击的国家/地区。

if ev.type == MOUSEBUTTONUP:
            # Get color underneath mouse cursor
            pos = ev.pos
            button = ev.button
            color = self.surface.get_at((pos))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM