-
Notifications
You must be signed in to change notification settings - Fork 36
Description
Proposal
I'm designing a js car racing game. In this game, player is in a race track protecting himself from collision from other cars
coming on the way.
This game is purely coded on javascript language and a little bit of CSS is used for styling backgrounds and all.
First of all, I have designed a div by name “carGAme”, after that a new div of “gameArea” I made, followed by “startScreen” div where you got instruction of how to play this game and finally a div for displaying the score.
I have fired an event on arrow keys, arrowDown for getting back on road, arrowup for move ahead ,arrowleft & arrowRight for left & right direction respectively. When we started game I put player.score value=0, now I have designed 5 road line & through a call back function we have repeated it in gameArea. After this I put 3 enemy car on road and repeat it until collision take place. Now defined the speed of player as 5px and increases player score until he quit/collide. When collision take place startScreen again come on top of screen showing final score and instruct user to play again
Hit this link to play game:-
https://car-racing-app-surajvatsya.herokuapp.com/
