Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: N5110 SDFileSystem gameCharacters mbed
main.h
00001 /** 00002 @file main.h 00003 @brief Revision 1.0. 00004 @author Robin Milward Cooney 00005 @date May 2015 00006 */ 00007 00008 //--------------------------------------INCLUSIONS--------------------------------------------------- 00009 00010 #include "mbed.h" 00011 #include "N5110.h" 00012 #include "math.h" 00013 #include "stdint.h" 00014 #include "SDFileSystem.h" 00015 #include "gameCharacters.h" 00016 00017 //--------------------------------------------------------------------------------------------------- 00018 00019 //-------------------------------------DEFINITIONS--------------------------------------------------- 00020 00021 #define joystickTolerance 0.05f 00022 00023 //--------------------------------------------------------------------------------------------------- 00024 00025 //--------------------------------------NAMESPACES--------------------------------------------------- 00026 00027 /** 00028 @namespace lcd 00029 @brief Output pins for lcd screen pin order: VCC,SCE,RST,D/C,MOSI,SCLK,LED 00030 */ 00031 N5110 lcd(PTE26,PTA0,PTC4,PTD0,PTD2,PTD1,PTC3); 00032 00033 /** 00034 @namespace led 00035 @brief LED bus output, each pinout represents a LED on a LED bar, from bottom to top 00036 */ 00037 BusOut led(PTC8,PTC9,PTC0,PTC7,PTC5); 00038 00039 /** 00040 @namespace sd 00041 @brief SD card output, the pins are in the following order: MOSI, MISO, SCK, CS 00042 */ 00043 SDFileSystem sd(PTE3, PTE1, PTE2, PTE4, "sd"); 00044 00045 /** 00046 @namespace red_led 00047 @brief Red LED output on mbed, used for error messages and debugging when reading and or writing on SD card 00048 */ 00049 DigitalOut red_led(LED_RED); 00050 00051 /** 00052 @namespace green_led 00053 @brief Green LED output on mbed, used for success messages when reading and or writing on SD card 00054 */ 00055 DigitalOut green_led(LED_GREEN); 00056 00057 /** 00058 @namespace swJoy 00059 @brief Switch on potentiomiter. DigitalIn and to be polled using a ticker 00060 */ 00061 DigitalIn swJoy(PTB18); //define potentiomiter switch 00062 00063 /** 00064 @namespace xPot 00065 @brief AnalogIn that correspods the horizontal movement of the joystick 00066 */ 00067 AnalogIn xPot(PTB2); 00068 00069 /** 00070 @namespace yPot 00071 @brief AnalogIn that correspods the virtical movement of the joystick 00072 */ 00073 AnalogIn yPot(PTB3); 00074 00075 /** 00076 @namespace b_A 00077 @brief Additional pushbutton (PullDown). DigitalIn and to be polled using a ticker 00078 */ 00079 DigitalIn b_A(PTE24); 00080 00081 /** 00082 @namespace b_A 00083 @brief Additional pushbutton (PullDown). DigitalIn and to be polled using a ticker 00084 */ 00085 DigitalIn b_B(PTE25); 00086 00087 /** 00088 @namespace press_bA 00089 @brief IterruptIn corresponding to the pushbutton A (PullDown). To be used when polling using a ticker is inconvinient or inefficient 00090 */ 00091 InterruptIn press_b_A(PTE24); 00092 00093 /** 00094 @namespace press_bA 00095 @brief IterruptIn corresponding to the pushbutton B (PullDown). To be used when polling using a ticker is inconvinient or inefficient 00096 */ 00097 InterruptIn press_b_B(PTE25); 00098 00099 /** 00100 @namespace PWM 00101 @brief Pulse width modulation output conected to buzzer to contol the music 00102 */ 00103 PwmOut PWM(PTC11); 00104 00105 00106 /** 00107 @namespace Ticker_Menu 00108 @brief Ticker used for polling the joysick and the digital inputs while the menu funtions are running 00109 */ 00110 Ticker Ticker_Menu; 00111 00112 /** 00113 @namespace Ticker_Game 00114 @brief Ticker used for polling the joysick and the digital inputs while the game funtion is running 00115 */ 00116 Ticker Ticker_Game; 00117 00118 /** 00119 @namespace Ticker_ds 00120 @brief Ticker used to create a more energy efficient wait() funtion 00121 */ 00122 Ticker Ticker_ds; 00123 00124 /** 00125 @namespace tOut 00126 @brief Timeout used to implement music. It turns the buzzer off at the correct moment 00127 */ 00128 Timeout tOut; 00129 00130 /** 00131 @namespace Highscores 00132 @brief File that stores an array of the top 5 highscores 00133 */ 00134 FILE *Highscores; 00135 00136 /** 00137 @namespace Progress 00138 @brief File that stores the progress (i.e unlocked chapeters) of the Story Mode 00139 */ 00140 FILE *Progress; 00141 00142 //-------------------------------------------------------------------------------------- 00143 00144 //---------------------------------VARIABLES-------------------------------------------- 00145 00146 int i =0; /*!< Loop counter for the game() funtion */ 00147 int recks_movement =2; /*!< Global variable that deffines the direction of all mobs with respect to Recks (main character)*/ 00148 int g_jump =36; /*!< Global variable that deffines the vertical possition of Recks and the bullet during the jumping action*/ 00149 int jumpUp ; /*!< Global variable that flags depending on the direction of Recks while jumping. 0 when going up, 1 when going down*/ 00150 int accel =0; /*!< Global variable that changes every loop during the jump to increase or decrease the velociry of Recks during the jump. Providing real time physics*/ 00151 int hound_jump =0; /*!< Global variable that changes every loop during the jump to increase or decrease the velociry of the hound during the jump. Providing real time physics*/ 00152 int fall =37; /*!< Variable that deffines the vertical possition of Recks when he is in Quick sand, decreases at a constant velocity*/ 00153 int bullet =9; /*!< Global variable that deffines the horizontal possition of the bullet*/ 00154 int bullet_height ; /*!< Global variable that deffines the vertical possition of the bullet*/ 00155 int menu_select ; /*!< Global variable, it the output of the fsm that deffines what item on the menus have been selected*/ 00156 int menuState =0; /*!< Global variable, it is the current state of the fsm*/ 00157 double lives =4; /*!< Global variable that indicates the number of lives Recks has*/ 00158 int score =0; /*!< Global variable inticating the overall number of points achieved duning the game, it is the variable saved to the highscores[] array after. 00159 Score=h_movement/10+killscore-shield_score*/ 00160 int kill_score ; /*!< Global variable inticating the number of points achieved duning by destroying the mobsr*/ 00161 int shield_score ; /*!< Global variable counting the ammount of times the shield has been used and for every time it decreases the overall score by 10 points*/ 00162 int shield_counter =0; /*!< Global variable that counts the number of loops the shield has been "On" for*/ 00163 int h_movement =0; /*!< Global variable that counts the distance travelled by Recks, and is used 00164 to contol the horizontal possition of the clouds. Diffrent to recks_movement in order so the 00165 forgrond can move faster than than the background giving it a sense of perspective. Also used 00166 to calcualte the score.*/ 00167 int ammo =24; /*!< Global variable indicating the number of bullets left to use, decreases when a bullet is shot, increasis when ammo is picked up*/ 00168 int g_shoot_loop =0; /*!< Global variable that prevents a bullet beeing shot while there is already a bullet on screen, when the bullet is onscreen it is >0 otherwhise it is 0*/ 00169 int fire_on_screen =0; /*!< Global variable that prevents another fireball beeing shot while there is already a fire ball on screen, when the fire ball is onscreen it is >0 otherwhise it is 0*/ 00170 int story_mode_flag =0; /*!< Global variable that flags when the player is in the story mode, rather than in the minigame */ 00171 int lose_lives_delay_flag =0; /*!< Global variable that flags when the player loses a life and resets to 0 after 1 second. This means that there is a recovery time after losing a life*/ 00172 int lives_delay_loop =0; /*!< Global variable indicating the number of times the lose_lives_delay_flag statement has iterated, after a certain numeer of itterations it resets the 00173 flag and the value to 0. Mening the revovery time is over*/ 00174 int difficulty =2; /*!< Global variable that dictates the probability of certain flags swtiching, i.e it it's low then less enemies appear therefore the game is easier*/ 00175 int story_progress =1; /*!< Global variable that indicates the story mode progress, it increases after each chapter then autosaves to the Progress file on SD card*/ 00176 int g_story_mode_win =0; /*!< Global variable that indicates whether the final chapter is complete*/ 00177 int bear_lives =0; /*!< Global vairable that indicates the number of bullets taken by the bear/3*/ 00178 int t_rex_lives =0; /*!< Global vairable that indicates the number of bullets taken by the T Rex/3*/ 00179 int g_music_count =1; /*!< Global vairable that indicates the location of the note in the song array*/ 00180 int g_top_scores [6]; /*!< Global array that stores the 6 top scores, only the 5 highest are printed*/ 00181 float brightness =0.5; /*!< Global vairable that indicated the brighntness of the lcd screen*/ 00182 int random_num ; /*!< Global vairable, random number created in the generate_random_number() funtion*/ 00183 int g_g1 ; /*!< Global vaiable that is is 1 when the players selects revolver*/ 00184 int g_g2 ; /*!< Global vaiable that is is 1 when the players selects rifle*/ 00185 00186 //******************MOVEMENT GLOBAL VARIABLES******************* 00187 // These global variables indicate the horizontal (or vertical) movement of all the different interactive elements (mobs, pick ups, speed boosts...) 00188 //If it's horizontal movement it is indicated by either "element name"_movement or "element name"_hMovement the vertical movement is indicaded by "element name"_vMovement 00189 int rat_movement =95; /*!< Global variable indicating the horizontal movement of the rat*/ 00190 int hound_hMovement =98; /*!< Global variable indicating the horizontal movement of the hound*/ 00191 int hound_vMovement =40; /*!< Global variable indicating the vertical movement of the hound*/ 00192 int bear_movement =100; /*!< Global variable indicating the horizontal movement of the bear*/ 00193 int bird_hMovement =95; /*!< Global variable indicating the horizontal movement of the bird*/ 00194 int bird_vMovement =20; /*!< Global variable indicating the vertical movement of the bird*/ 00195 int cactus_movement =110; /*!< Global variable indicating the horizontal movement of the cactus*/ 00196 int t_rex_movement =120; /*!< Global variable indicating the horizontal movement of the T Rex*/ 00197 int quick_sand_movement =85; /*!< Global variable indicating the horizontal movement of the Quick sand*/ 00198 int fire_ball_hMovement =t_rex_movement -6; /*!< Global variable indicating the horizontal movement of the fire ball made by the T Rex*/ 00199 int fire_ball_vMovement =25; /*!< Global variable indicating the vertical movement of the fire ball made by the T Rex*/ 00200 int heart_movement =90; /*!< Global variable indicating the horizontal movement of the fire ball made by the heart pick up*/ 00201 int ammo_movement =100; /*!< Global variable indicating the horizontal movement of the fire ball made by the ammo pick up*/ 00202 int speed_boost_movement =130; /*!< Global variable indicating the horizontal movement of the fire ball made by the speed boost pick up*/ 00203 //************************************************************** 00204 00205 //*****FLAGS FOR ACCTIONS AND PRINTING INTERACTIVE ELEMENTS***** 00206 //These falgs are randomly activated (more or less frequently depending on the difficulty). For interactive elements when the flag is "On" (=1) the 00207 //element is printed, the flag is then cleared when the element either moves offscreen or is destroyed or picked up. For the action flags (jump, shoot 00208 //shield) the flag is cleared when the action is over. 00209 int jump_flag =0; /*!< Global variable that flags (=1) when the jump button is pressed and unflags(=0) when the jump has finished*/ 00210 int shoot_flag =0; /*!< Global variable that flags (=1) when the shoot button is pressed and unflags(=0) when the bulllet has left the screen*/ 00211 int shield_flag =0; /*!< Global variable that flags (=1) when the shield is activated (joystick pointed upwards)and unflags(=0) after 1 second*/ 00212 int print_rat_flag =0; /*!< Global variable that flags (=1) randomly and prints the rat onscreen. It unflags(=0) when the rat leaves the screen*/ 00213 int print_hound_flag =0; /*!< Global variable that flags (=1) randomly and prints the hound onscreen. It unflags(=0) when the hound leaves the screen or is destroyed*/ 00214 int hound_jump_flag =0; /*!< Global variable that flags (=1) randomly to make the hound jump. It unflags(=0) when the jump is over*/ 00215 int print_bear_flag =0; /*!< Global variable that flags (=1) randomly and prints the bear onscreen. It unflags(=0) when the bear leaves the screen or is destroyed*/ 00216 int print_bird_flag =0; /*!< Global variable that flags (=1) randomly and prints the bird onscreen. It unflags(=0) when the bird leaves the screen or is destroyed*/ 00217 int print_heart_flag =0; /*!< Global variable that flags (=1) randomly and prints the heart pickup onscreen. It unflags(=0) when the pickup leaves the screen or is picked up*/ 00218 int print_ammo_flag =0; /*!< Global variable that flags (=1) randomly and prints the ammo pickup onscreen. It unflags(=0) when the pickup leaves the screen or is picked up*/ 00219 int print_speed_boost_flag =0; /*!< Global variable that flags (=1) randomly and prints the speed boost pickup onscreen. It unflags(=0) when the pickup leaves the screen or is picked up*/ 00220 int print_cactus_flag =0; /*!< Global variable that flags (=1) randomly and prints the cactus onscreen. It unflags(=0) when the cactus leaves the screen*/ 00221 int print_t_rex_flag =0; /*!< Global variable that flags (=1) randomly and prints the T Rex onscreen. It unflags(=0) when the T Rex leaves the screen or is destroyed*/ 00222 int print_fire_ball_flag =0; /*!< Global variable that flags (=1) randomly when the print_t_rex_flag is flagged and prints the T Rex onscreen. It unflags(=0) when the fire ball leaves the screen*/ 00223 int print_quick_sand_flag =0; /*!< Global variable that flags (=1) randomly and prints the quicksand onscreen. It unflags(=0) when the quicksand leaves the screen*/ 00224 //**************************************************************** 00225 00226 //*******************FLAGS FOR TICKERS AND INTERRUPTS************* 00227 volatile int g_Ticker_Menu_flag =0; /*!<Global variable to flag the menu ticker*/ 00228 volatile int g_Ticker_Game_flag =0; /*!<Global variable to flag the game ticker*/ 00229 volatile int g_Ticker_Music_flag =0; /*!<Global variable to flag the music ticker*/ 00230 volatile int g_Ticker_ds_flag =0; /*!<Global variable to flag the ticker for the ticker wait funtion*/ 00231 volatile int g_press_b_A_flag =0; /*!<Global variable to flag the Interrupt of button A*/ 00232 volatile int g_press_b_B_flag =0; /*!<Global variable to flag the Interrupt of button B*/ 00233 //***************************************************************** 00234 00235 //***********************FINITE STATE MACHINE********************** 00236 struct menuState { /*!<Struct declaring the fsm */ 00237 int menu_select ; 00238 int nextState[5]; 00239 }; 00240 typedef const struct menuState STyp; 00241 00242 STyp fsm_main_menu[5] = { 00243 {0,{0,1,4,0,0}}, 00244 {8,{1,2,0,1,1}}, 00245 {16,{2,3,1,2,2}}, 00246 {24,{3,4,2,3,3}}, 00247 {32,{4,0,3,4,4}} 00248 }; 00249 00250 STyp fsm_settings_menu[5] = { 00251 {0,{0,1,2,0,0}}, 00252 {8,{1,2,0,1,1}}, 00253 {16,{2,3,1,2,2}}, 00254 {24,{3,0,2,3,3}}, 00255 {32,{4,4,4,4,4}} 00256 }; 00257 //***************************************************************** 00258 00259 enum joystickDirection { //enum type for every neccessary direction of the joystick 00260 CENTRE, //when the joystick isn't moved 00261 DOWN, 00262 UP, 00263 LEFT, 00264 RIGHT, 00265 }; 00266 00267 typedef struct JoyStick Joystick; //struct for Joystick 00268 struct JoyStick { 00269 float x; // current x value 00270 float x0; // 'centred' x value 00271 float y; // current y value 00272 float y0; // 'centred' y value 00273 int swJoy; // button state (assume pull-down used, so 1 = pressed, 0 = unpressed) 00274 joystickDirection direction; // current direction 00275 }; 00276 00277 // create struct variable 00278 Joystick joystick; 00279 00280 00281 00282 //------------------------------------------------------------------------------------------------------------------ 00283 00284 //---------------------------------------------FUNTIONS------------------------------------------------------------- 00285 00286 /// Initializes all game values so that when the game ends everything returns to it's normal state 00287 void initialize_values(); 00288 00289 /**Waits for t/10 seconds, a more energy efficient but same funtionality as wait() 00290 @param t - time in 0.1*seconds*/ 00291 void ticker_wait(int t); 00292 00293 ///Generates a random munber between 0 and 9999 using the clock on the mbed as a source for the srand() funtion 00294 void generate_random_number(); 00295 00296 ///Displayes the current number of lives on the led bar 00297 void led_bar(); 00298 00299 ///Plays the next note form song1 array on the piezo buzzer 00300 void play_music(); 00301 00302 //*******************TICKERS, INTERUPTS AND TIMEOUTS**************** 00303 ///Funtion that sets g_Ticker_Menu_flag=1 00304 void Ticker_Menu_isr(); 00305 00306 ///Funtion that sets g_Ticker_Game_flag=1 00307 void Ticker_Game_isr(); 00308 00309 ///Funtion that sets g_Ticker_ds_flag=1 00310 void Ticker_ds_isr(); 00311 00312 ///Funtion that sets PWM.period=0.0, so that the tune stops when it times-out 00313 void music_tOut(); 00314 00315 ///Funtion that sets g_press_b_A_flag=1 00316 void press_b_A_isr(); 00317 00318 ///Funtion that sets g_press_b_B_flag=1 00319 void press_b_B_isr(); 00320 00321 //******************************************************************* 00322 00323 //******************************JOYSTICK***************************** 00324 /**Funtion that reads the joystick position when it is still and form those readings it allocates 00325 values of xPot and yPot that are equicalent to the directions UP, DOWN, LEFT, RIGHT, CENTRE*/ 00326 void calibrateJoystick(); 00327 00328 /**Reads the current values of xPot and yPot and detemins the position of the joysick*/ 00329 void updateJoystick(); 00330 00331 //******************************************************************* 00332 00333 //*******************SD CARD & FILE MANAGEMENT*********************** 00334 /**Reads the Pregress file on the SD card*/ 00335 void readSD_progress(); 00336 00337 /**Writes the current game progress onto the Progress file on the SD card*/ 00338 void writeSD_progress(); 00339 00340 /**Reads the Highscores file on the SD card and prints the 5 highest numbers in the Highscores array on the lcd screen*/ 00341 void readSD_and_print_top_score(); 00342 00343 /**Writes the topscore on the 6th position in the Highscores array (so it doesn't overwrite any values that are already stored)*/ 00344 void writeSD(); 00345 00346 ///Sorts the values and orders them in descending order 00347 void sort_top_scores(); 00348 00349 /**Funtion to delete a file 00350 @param filename[] - Name of file that is to be deleted*/ 00351 void delete_file(char filename[]); 00352 00353 ///Delete the Highscores file 00354 void Delete_Highscores(); 00355 00356 //***************************************************************** 00357 00358 //************************PRINTING ON LCD************************** 00359 ///Prints the name of the game for 3 seconds when it's turned on 00360 void intro(); 00361 00362 ///Prints the credits on the LCD 00363 void Credits(); 00364 00365 ///Prints the floor on the LCD 00366 void ground(); 00367 00368 ///Prints the g_heart array on the LCD 00369 void print_heart(); 00370 00371 ///Prints the g_ammo_pickUP on the LCD 00372 void print_ammo_pickUp(); 00373 00374 ///Prints the g_speed_boost on the LCD 00375 void print_speed_boost(); 00376 00377 ///Prints Recks (main character), the g_recks_still_gun array on the LCD 00378 void print_recks_still_gun(); 00379 00380 ///Prints the g_recks_moving_gun array on the LCD 00381 void print_recks_moving_gun(); 00382 00383 ///Prints the g_recks_crouch_gun array on the LCD 00384 void print_recks_crouch_gun(); 00385 00386 ///Prints the g_recks_shield array on the LCD 00387 void print_recks_shield(); 00388 00389 ///Prints the g_recks_jump_gun array on the LCD 00390 void print_recks_jump_gun(); 00391 00392 ///Prints the g_recks_falling array on the LCD 00393 void print_recks_falling(); 00394 00395 ///Prints the g_mob_rat_p1 (position 1) array on the LCD 00396 void print_mob_rat_p1(); 00397 00398 ///Prints the g_mob_rat_p2 (position 2) array on the LCD 00399 void print_mob_rat_p2(); 00400 00401 ///Prints the g_mob_hound_p1 (position 1) array on the LCD 00402 void print_mob_hound_p1(); 00403 00404 ///Prints the g_mob_hound_p2 (position 2) array on the LCD 00405 void print_mob_hound_p2(); 00406 00407 ///Prints the g_mob_hound_dead array on the LCD 00408 void print_mob_hound_dead(); 00409 00410 ///Prints the g_mob_bear_p1 (position 1) array on the LCD 00411 void print_mob_bear_p1(); 00412 00413 ///Prints the g_mob_bear_p2 (position 2) array on the LCD 00414 void print_mob_bear_p2(); 00415 00416 ///Prints the g_mob_bear_dead array on the LCD 00417 void print_mob_bear_dead(); 00418 00419 ///Prints the g_mob_bird_p1 (position 1) array on the LCD 00420 void print_mob_bird_p1(); 00421 00422 ///Prints the g_mob_bird_p2 (position 2) array on the LCD 00423 void print_mob_bird_p2(); 00424 00425 ///Prints the g_mob_bear_dead array on the LCD 00426 void print_mob_bird_dead(); 00427 00428 ///Prints the cactus array on the LCD 00429 void print_cactus(); 00430 00431 ///Prints the g_t_rex array on the LCD 00432 void print_t_rex(); 00433 00434 ///Prints the g_t_rex_moving array on the LCD 00435 void print_t_rex_moving(); 00436 00437 ///Prints the g_t_rex_attack array on the LCD 00438 void print_t_rex_attack(); 00439 00440 ///Prints the g_fire_ball_p1 (position 1) array on the LCD 00441 void print_fire_ball_p1(); 00442 00443 ///Prints the g_fire_ball_p2 (position 2) array on the LCD 00444 void print_fire_ball_p2(); 00445 00446 ///Prints the g_clouds array on the LCD 00447 void print_clouds(); 00448 00449 /**Prints the g_clouds array on the LCD. It prints it multiple times next to the 00450 corresponding chapter. They are either locked or unlocked depending on the 00451 story_progress value*/ 00452 void print_locks(); 00453 00454 /// Prints a line of lengh 16 one pixel above the ground 00455 void print_quick_sand(); 00456 00457 /// Prints animation of Recks sinking in quick sand 00458 void falling_animation(); 00459 00460 ///Prints "SCORE" and the current score value on the top left of the LCD screen 00461 void print_score(); 00462 00463 ///Pritns "AMMO" and the remaining ammo on the top right of the LCD screen 00464 void print_ammo(); 00465 //*************************************************************** 00466 00467 //******************************MENU'S*************************** 00468 /**Funtion that pritns the main menu options and allows the user to select 00469 one of the options by pressing the button A. */ 00470 void main_menu(); 00471 00472 /**Funtion that pritns the story mode menu options and allows the user to select 00473 one of the chapters by pressing the button A or returning to the main menu by 00474 pressing the button B. */ 00475 void Story_Mode(); 00476 00477 /**Funtion that pritns the settings menu options and allows the user to select 00478 one of the options by pressing the button A or returning to the main menu by 00479 pressing the button B. */ 00480 void Settings(); 00481 00482 /**Funtion that pritns the brightness menu options and allows the user to select 00483 one of the different brightnesses by pressing the button A or returning to the 00484 main menu by pressing the button B. */ 00485 void Brightness(); 00486 00487 /**Funtion that pritns the difficulty menu options and allows the user to select 00488 one of the different difficulties by pressing the button A or returning to the 00489 main menu by pressing the button B. */ 00490 void Difficulty(); 00491 00492 /**Funtion that allows the user to view the highscores and returning to the main 00493 menu by pressing the button B. */ 00494 void Leaderboard(); 00495 00496 /**Funtion that pritns the guns options and allows the user to select 00497 one of the different guns by pressing the button A or returning to the 00498 main menu by pressing the button B. */ 00499 void guns(); 00500 //**************************************************************** 00501 00502 //***************************GAME PHYSICS************************* 00503 /**Funtion that contols the motion, physics and interations of Recks with the other 00504 interactive elements*/ 00505 void Recks(); 00506 00507 /**Funtion that contols the motion, physics and interations of the rat with Recks*/ 00508 void rat(); 00509 00510 /**Funtion that contols the motion, physics and interations of the hound with Recks*/ 00511 void hound(); 00512 00513 /**Funtion that contols the motion, physics and interations of the bear with Recks*/ 00514 void bear(); 00515 00516 /**Funtion that contols the motion, physics and interations of the bird with Recks*/ 00517 void bird(); 00518 00519 /**Funtion that contols the motion, physics and interations of the cactus with Recks*/ 00520 void cactus(); 00521 00522 /**Funtion that contols the motion, physics and interations of the T Rex with Recks*/ 00523 void t_rex(); 00524 00525 /**Funtion that contols the motion, physics and interations of the fire ball with Recks*/ 00526 void fire_ball(); 00527 00528 /**Funtion that contols the motion, physics and interations of the quick sand with Recks*/ 00529 void quick_sand(); 00530 00531 /**Funtion that contols the motion, physics and interations of the heart pickup with Recks*/ 00532 void heart(); 00533 00534 /**Funtion that contols the motion, physics and interations of the ammo pickup with Recks*/ 00535 void pickUp_ammo(); 00536 00537 /**Funtion that contols the motion, physics and interations of the speed boost with Recks*/ 00538 void speed_boost(); 00539 00540 /**Funtion that turns on the shield*/ 00541 void shield(); 00542 //**************************************************************** 00543 00544 //***************************GAME MODES*************************** 00545 /**This funtion sets flags for printing interactive elements, depending on the difficulty 00546 leavel selected*/ 00547 void set_difficulty(); 00548 00549 /**Funtion that runs the game*/ 00550 void Game(); 00551 00552 /**Funtion that runs the game without the sory mode*/ 00553 void Minigame(); 00554 00555 /**Funtion that prints sequential text introducing the game, and the game funtions*/ 00556 void Tutorial(); 00557 00558 /**Funtion that prints sequential text introducing the story and then runs the game 00559 on a easy difficulty setting*/ 00560 void Chapter1(); 00561 00562 /**Funtion that prints sequential text expanding the story and then runs the game 00563 on a increased difficulty setting*/ 00564 void Chapter2(); 00565 00566 /**Funtion that prints sequential text expanding the story and then runs the game 00567 on a increased difficulty setting*/ 00568 void Chapter3(); 00569 00570 /**Funtion that prints sequential text expanding the story and then runs the game 00571 with a final boss fight*/ 00572 void Chapter4(); 00573 00574 /**Funtion that runs when the lives global variable is 0. Printing a game over message 00575 @returns 0 or 1. 0 returns back to the main menu and 1 re-plays the game after initializing values 00576 */ 00577 int Game_over(); 00578 00579 /**Funtion that stops the game and powers down the LED's until the joystick button is pressed*/ 00580 void Pause(); 00581 //***************************************************************** 00582 00583 00584
Generated on Fri Jul 22 2022 22:31:14 by
1.7.2