contains my game for the embedded systems project 2645
Dependencies: mbed FXOS8700CQQQ
Diff: GameEngine/RocketRacer.h
- Revision:
- 28:39607fb67e88
- Parent:
- 27:771d186b1bc8
- Child:
- 29:e660274d8222
diff -r 771d186b1bc8 -r 39607fb67e88 GameEngine/RocketRacer.h --- a/GameEngine/RocketRacer.h Sun Apr 21 11:26:12 2019 +0000 +++ b/GameEngine/RocketRacer.h Wed Apr 24 10:19:07 2019 +0000 @@ -6,6 +6,7 @@ #include <ctime> #include "Gamepad.h" #include "GameSprites.h" +#include "GameTones.h" /** RocketRacer class @@ -18,7 +19,6 @@ @date April 2019 @code - #include "mbed.h" #include "N5110.h" #include "Gamepad.h" @@ -27,21 +27,49 @@ // objects Gamepad pad; RocketRacer rc; -Menus menus; + // prototypes void setup(); int main(){ - + //initializes the gamepad and the lcd setup(); - menus.welcomeMenu(pad,lcd); - menus.InstructionsMenu(pad,lcd); - //keeps looping untill the player loses + +// this method displays the game scoresand frames +// used in the gameplay + + Rocket_Racer.Main_Game_Display(lcd); + +// this method checks the joystick position +// if it's right prints "its right" else if its +// left prints "its left" else prints "centre" + Rocket_Racer.Joystick_position(pad); + //this method generates a random number between 1 and 3 + //and prints it to the terminal + Rocket_Racer.Generate_New_Enemy(); + //this method checks if the rocket collide with the enemy + //and displays game over screen + Rocket_Racer.Check_Enemy_Dead(lcd,pad); + //main game loop that has all the method calls in it while(1){ Rocket_Racer.Game_Loop(lcd,pad); } + //method that adds difficulty to the game + //and has 6 levels of difficulty + Rocket_Racer.Game_difficulty(pad); + //this method places the enemy sprite according + //to the randomly generated number(1->3)& the current phase + //i added the 2nd and 3rd argument manually for testing + Rocket_Racer.enemy_position(lcd,2,3); + //this method places the player sprite + //according to the postion of the joystick + //i added the 2nd argument manually for testing + Rocket_Racer.player_position(lcd, 3); + //this method displays the gameover screen + //and the high score achieved + Rocket_Racer.End_Game(pad,lcd); } @@ -115,13 +143,11 @@ * @param phase @details the phase of the rocket */ void enemy_position(N5110 &lcd,int place, int phase); - /** - * @brief method that plays the gameover melody - *@param pad @details calls the Gamepad object to be passed to the method called inside this method - */ - void End_Game_Melody(Gamepad &pad); + + private: + int first_enemy_position; int second_enemy_position; int enemy_phase; @@ -130,7 +156,8 @@ char Init_position; bool enemy_dead; bool control; - + GameTones tones; + }; #endif \ No newline at end of file