I am making a space game. when the spaceship hits a asteroid it destroys the asteroid, but I want it so it will also make the spaceship blow up after a couple of asteroids hit it.
Sounds like you will need an instance field in the class of the spaceship to count the number of asteroid hits; and then some code to check its value to see if the ship needs to blow up.