Hi, I’d like a little help arranging the logical layout of the code for a game.
The Concept:
Every time you click a button a plastic army man is spawned. You can spawn as many army men as you like. The user also has control over the intensity of a burning fire and can pick up spawned army men and drop them into the fire and they will eventually melt. The intensity of the fire is user controlled through a slider control. If the fire is "High" intensity then it takes 1 second for the army man to melt, if the fire is "Medium" intensity it takes 2 and if the fire is "low" then it takes 3 seconds. A melted army man becomes a blob of plastic which can be picked up and moved.
How would you keep track of it all?
I’m thinking the logical layout would be
1) Create a table to track spawned army men and also give them a health value
Armyman[i].health = 3
2) Once in the fire create some sort of loop that has a timer which subtracts one value from armyman[i].health until it reaches zero. Have the value of armyman[i].health return to 3 if it is removed from the fire before it reaches 0.
3) If armyman.health = 0, then create a melted blob in its place and delete armyman[i]
Is this the best approach?