This project is part of the Frontend Web Developer Nanodegree (full Google scholarship). This project's purose is to practice JavaScript's object-oriented programming
A starter code containing the main game's engine and resource loader has been provided. The goal was to develope all the objects and the functions to render all the characters and the texture, control them and define the game's rules. The game is pretty easy: you have to reach the top side of the canvas (water) with the player, avoiding the bugs coming from the left side of the screen. The player has 3 attempt (lives) to eventually win the game.
You can clone this repository or download it as a .zip file, then simply open the index.html
file with your favourite browser and start to play!
If you'd like to play a full version of the game, just click here! and enjoy.
I've used ES2016's classes to define enemies and player. Both the classes have their one properties and functionalities:
- Enemies' "y" and "speed" definers: these functionalities are made to randomly select the new y position and speed of the enemies every time they exit from the screen
- Enemies' collision handler: to define when the enemy hit the player
- Player's lives: every time the player crash into a bug, one life and one heart on top of the screen are removed. Player has 3 lives in total.
- Input handler: define how the player moves into the canvas pressing arrow keys
The game has to follow some code criteria in order to satisfy the project specifications. The full detailed list of the requirements is available to consult at the Project Rubric Link.
The project is created starting from the original Udacity's Project.
I've used the following resources in order to complete the project:
Javascript:
All suggestions and tips will be more than appreciated but, as general rule, no pull requested are normally accepted.
This project is still pretty raw and I would like to add some extra functionalities to make it a little bit more interesting, like:
- Select the player image
- Add collectable to earn points
- Add a score system
- Add a timer
- Add some other random enemies
- Enlarge the canvas
- Add style to the whole page