Multi-tile objects on tiled map

六月ゝ 毕业季﹏ 提交于 2019-12-24 09:20:25

问题


I'm trying to write rts-like-tile-based game using Tiled and slick2d.

I don't know how to handle a multi-tile objects, like buildings, how to create, keep and e.g. move them.


回答1:


One solution would be to create a layer in tiled where the tiles are used as "markers" for your game code. These "markers" are never drawn. Instead, when you initialize your game, go through the the tiled map and every time a corresponding marker is found add a "new Building()" to some kind of EntityManager class. This way you can write the code for the class Building yourself, and instead of it being completely static tile you can move it around like you would any other entity. This also lets you make these buildings any arbitrary size independently of any tile sizes.



来源:https://stackoverflow.com/questions/14307668/multi-tile-objects-on-tiled-map

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!