I am trying to make a demo, which consists of pressing a button. Every time u press the button, the enemy on screen, (1 at a time) would take damage until it reaches 0. Once the enemy dies, I would like to spawn an enemy with the same 'behavior', (takes damage when I press the button), but with different values for its health, (instead of 100 max hp, 200 max hp). How would I do this?
Thanks in advance ;)
You can use a global variable.
Then on enemy destroyed > set global variable to 200 (or do whatever you want with it for the next enemy).
Then on enemy created > set hp to global variable.
Develop games in your browser. Powerful, performant & highly capable.
Oh ok, thank u so much!