How to get the sprite locations?

0 favourites
  • 3 posts
From the Asset Store
A set of 10 pixel art animated magic effects with icons. 2 Fire, 2 Earth, 2 Wind, 2 Water, Portal, Explosion.
  • Hi there,

    I want to make a game which the player had a enemy radar, can check the enemy base location. I don't know how to get the sprites location (X,Y) (maybe pick nearest is a good choice), but can I use the UID as index and get all the sprites information? what if I want to get all the enemy bases in List menu? is it hard to complete in CS2?

    Thanks for your help...

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I think I understand where your going with this. spite.X, sprite.Y is the position. Pick nearest works but, only for the nearest. If the information is stored in instance variables of the spite, it's easy to retrieve and send to a text box, for example, "Textbox set text to sprite.info". Create a family called FamilyEnemy and put all your enemy bases in it. Then use pick nearest.

    I have a radar that works tracking moving objects and displays in a radar screen. It's not exactly what your looking for but the principle is the same for obtaining X and Y positions.

    The info displays with a visual radar at the bottom of the screen, displaying objects off screen.

    If you want to display info for multiple base locations and multiple info for each, it depends on how much info you want to display and how you want to display it. You'll have to calculate the distance for each and use that info to sort the enemy bases by distance. It would be best to load into an array and sort within an array.

    Hope this helps get you started...

  • Thank you so much for your help!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)