How to get the sprite locations?

Discuss game development design and post your game ideas

Post » Tue Jun 03, 2014 10:47 am

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...
You do not have the required permissions to view the files attached to this post.
B
9
S
3
Posts: 2
Reputation: 549

Post » Tue Jun 03, 2014 11:51 am

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.

Image


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

Image

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...
Image
B
75
S
23
G
3
Posts: 673
Reputation: 9,283

Post » Tue Jun 03, 2014 12:15 pm

Thank you so much for your help!
B
9
S
3
Posts: 2
Reputation: 549


Return to Game Development, Design & Ideas

Who is online

Users browsing this forum: No registered users and 3 guests