[英]LibGDX: Tiled Maps: How to click on an object
I have a tiled map on my libGDX project where I can move it using the keys on my keyboard. 我的libGDX项目上有一个平铺的地图,可以使用键盘上的键移动它。 I have set up boundaries so it doesn't go outside the tiled map.
我已经设置了边界,因此它不会超出平铺地图的范围。 In my tiled map I have three layers a background layer and two other layers for the pictures of my shop.
在我的平铺地图中,我的商店图片有三层,即背景层和另外两层。 I am wonder how I would be able to click on the shops so it brings on a menu.
我不知道我如何能够点击商店,从而带来一个菜单。 The only problem I have is they move!
我唯一的问题是他们搬家! Is there a simple way to do this?
有没有简单的方法可以做到这一点? You may have to dumb it down for me because I am new at coding in java/libGDX!
您可能不得不为我哑巴,因为我是Java / libGDX编程的新手!
Here is my code for detecting the touch currently but I know this will get messed up once I move my camera. 这是我当前用于检测触摸的代码,但是我知道一旦移动相机,这将变得一团糟。
if (touch.x <= 1300 && touch.x >= 700 && touch.y <= 700 && touch.y >= 0){
weapons_menu.setVisible(true);
move_camera = false;
}
Thanks, 谢谢,
Nehemiah 尼希米记
maybe this can help you: 也许这可以帮助您:
LibGDX: How to make tiled map tiles clickable? LibGDX:如何使平铺的地图图块可点击?
or this: 或这个:
https://stackoverflow.com/search?q=%5Blibgdx%5D+tiled+maps+click https://stackoverflow.com/search?q=%5Blibgdx%5D+tiled+maps+click
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.