heres my script
i didnt know what to put for the variable near the end to destroy the enemy when its out of health so i just tried random stuff and found that this combination came up with no errors, except the cube is destroyed at the start of the game, i tried
and that just destroyed the enemy 3 seconds after the start of the game
asked Sep 20 '11 at 07:45 AM
Hi sam11x, sorry, I'm not sure to have understand your question very well...Do you say that the enemy is destroied at the beginning of the execution? In that case, I think that
is wrong. To perform the "Destroy (enemy);" instruction inside the "if" statement you have to delete the ";" at the end of that line. So:
Let me know.
The correct usage for an if statement is:
such a simple mistake :).
Also, i would change "health == 0" to "health <=0". This will solve a future bug that occurs when the enemies health is below 0, which would become a problem if, for example, there was a different bullet that inflicted 5 damage ;).