Video: https://youtu.be/UCQitU5sXm8
The Dinosaur game is the iconic, not so secret game that many google users have played while waiting to get back internet access. The purpose of the game is to play as a dino that has to survive as long as possible while avoiding obstacles in a desert, traditionally a cactus and bird. In our dino game instead of avoiding a measly cactus, you have to avoid the actual cause of dino extinction… a meteor. Through this game you use the spacebar and down arrow key to jump and duck the meteor and cacti that progressively get faster as your score goes up. The purpose of the game is to get Highest score you can till you inevitably hit an obstacle, and are forced to give up, or try to set a new highscore.
Space Bar: Restart Game/Dino Jump
Down Key: Dino Accelerates Down
Background class is img that doesn't chage throught entire game
The character the player controls, and is the one that eitehr jumps or ducks. Created in the Frame.
This is the main obsticale throught the Entire playthrough of the game. There are 2 cacti objects present in the slower stages of the game, while there is 1 object present throughout the rest of the game, which does move faster as the game progresses and is complemented by the meteor that will me covered in the next class.
The secondary obsticale throughout the game. There is only 1 meteor object present, but it appears above the cactus and dino, and is meant to catch the player off-gurad whie jumping. It has movement mechnics similar to the cacti where it gets faster as the score progresses, but resets once it colides with the dino, or goes past the dino on the left side of the screen where it resets it's x position to the right so it can continue being an obsticale to the player.
This method draws the background, meteor, cacti, and the dino. Essenstially being the reason why we are able to see anything that goes on due to the code. The paint method is constantly updated to display the objects at various locations and at diffrent intervals making it vital for every object in the game.
This method prevents the dino from going out of bounds, and regulates how fast the acceleration of the dino is. It also is where the game can recognize to stop all movement and display game over when the dino collides with an obstacle.
Collisons occur when the dino collides with either the meteor or the cacti. The way the collison works is that since the dinosaur itself doesn't move on the x-axis, the meteor and cacti move to the left, and if the meteor and cacti have a certain range of x values while the dino is either mid air or on the ground, a collison occurs stopping the game. Reseting the positions of the meteor and cacti, while stopping the dino in the exact position it was when it was hit.
When Space bar is pressed, it makes sure the Dino jumps once, and can't jump again mid air to avoid objects. the game.
Objects created individualy, except cacti that were arrays and made multiple times.
Contact Vedant or Leon if there are any questions that need clarification, or any bugs you want to report.
Though future work on this project dosne't seem to likely, one possibility is to make the background correlate to the score intead of being a gif, Another is to make the ducking have an actual animation other and purpose other than going down faster.
Anyone is free to contribute or add to this game.
This game is ispired by the offline T-Rex Game, and could not have been completed without the help of Mr.David, who helped us with the array needed to show multiple cacti on the screen, as well as giving us this oppertunity to test out all the coding skills we have accumilated sicne the begining of the year.













