charlenedelceppo / Assignment-2-space-invaders

This is a space invaders game which was created by Unity. The game consists of a spaceship (player) which needs to kill the aliens by shooting the laser upwards to hit them. The aliens will be moving across the screen from left to right and right to left. The player can move the spaceship across the screen too. The aliens will be shooting lasers too and if they hit the spaceship the player's health will start to decrease. The health will be set to 100 and if they hit th player enough to 0 the game ends "game over". When starting the game the user will entering the name and will be shown during the gameplay.
0 stars 0 forks source link

When I finish the game and make new game the results of previous game will not reset #4

Open charlenedelceppo opened 11 years ago

charlenedelceppo commented 11 years ago

The problem that I was having is that when I play the game and finishes it and make a new game the results of previous game will still on screen and blink the screen. I didn't have a code in the Menu generator which says that when the new game then OK button is clicked it should reset everything to zero.

charlenedelceppo commented 11 years ago

if(GUI.Button(Rect(xLength-50,yLength,100,30), "Ok")) { //this is reseting all the values to the beginning of the game when click new game SpaceshipController.hit=0; SpaceshipController.score=0; SpaceshipController.health=100; SpaceshipController.fired=0;

            //when OK is clicked it will proceed to level 1             
            Application.LoadLevel(1);
        }
}