I am creating an RTS game where the player can create new units. My only problem is that I cannot give the new units a number of lives. Is there any way to do that?
Printable View
I am creating an RTS game where the player can create new units. My only problem is that I cannot give the new units a number of lives. Is there any way to do that?
By this do you mean you want each unit to have its own HP?Quote:
Originally Posted by ad
You can't use the Lives object - that's for the user only. You'd have to use separate counters and spread an id through both them and the units. Then, have this event:
+ ID of Unit = ID of Counter
- Set Counter to HP("Unit") //HP("Unit") being an alterable value within the Unit. Open up the Unit in the properties, go to the A-Z, and name an alterable value to HP)
- Set position of Counter to (0, 0) from Unit //add an offset here so that the counter isn't right on top of the Unit, probably something like (0, -16) )
You actually don't need to bother keeping the counters matched with specific units, MMF will auto-associate them. The counters could swap between different units, but because you're setting the position and value at the same time the one above each unit will always be showing that unit's health.
Just make sure you always have the right number of counters.
Oh, right. I forgot! Thanks for clarifying Dynasoft!