Hey everyone, I was wondering how do I make the code below wait for 5 seconds before executing?
Basically this code is meant to end the game if the rock hits the rocket but seen as the rocks are randomly placed they are sometimes on top of the rock and as soon as I run it the game ends which is no fun at all :( so I want to add a line of code that makes the rocket invinsible for the first 5 seconds of the game.
public void collision() { Rocket target = (Rocket) getOneIntersectingObject(Rocket.class) ; if( target != null) { target.setImage("Explosion.jpg"); getWorld().removeObject( target ) ; Greenfoot.stop(); } }