简体   繁体   中英

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. 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!

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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