Survivng Earth is a game where the player must fend off the asteroids from the Earth to save it. The game ends when an asteroid hits the earth.
- game has an earthball which is located in the bottom
- asteroids target the earth
- per mouse click on asteroids they explode
- asteroids appear randomly from the left,right,top of the screen
- asteroids change speed randomly
- number of asteroids increase gradually and randomly
- when one asteroids hits the earth the game ends
- score counts how many asteroids were hit
- add music
- Multiple levels to increase the difficulty- more asteroids appear which should not smashed
- buildSplashScreen () {}
- buildGameScreen () {}
- buildGameOverScreen () {}
- Game () {}
- Loop () {}
- checkCollisions () {}
- clearCanvas () {}
- updateCanvas () {}
- drawCanvas () {}
- GameOver () {}
- asteroids () { this.x; this.y; this.direction; this.interval }
- draw () {}
- move () {}
- speed () {}
- amount(){}
- checkScreenCollision () {}
-
Earth () { this.x; this.y;
}
-
draw () {}
-
checkCollision () {}
Definition of the different states and their transition (transition functions)
- splashScreen
- gameScreen
- gameOverScreen
- main - buildDom
- main - buildSplashScreen
- main - addEventListener
- main - buildGameScreen
- main - buildGameOverScreen
- game - startLoop
- game - buildCanvas
- game - updateCanvas
- game - drawCanvas
- asteroids - draw
- asteroids - move
- asteroids- increase
- asteroids-speed up
- asteroids- addEventListener
- game - checkCollision
- earth - draw
- earth - checkCollision
- game - GameOver
- game - addEventListener
URls for the project repo and deploy: