ELEC2645 (2015/16) / Mbed 2 deprecated Robozoec_Era

Dependencies:   N5110 SDFileSystem gameCharacters mbed

Embed: (wiki syntax)

« Back to documentation index

main.h File Reference

main.h File Reference

Revision 1.0. More...

Go to the source code of this file.

Namespaces

namespace  lcd
 

Output pins for lcd screen pin order: VCC,SCE,RST,D/C,MOSI,SCLK,LED.


namespace  led
 

LED bus output, each pinout represents a LED on a LED bar, from bottom to top.


namespace  sd
 

SD card output, the pins are in the following order: MOSI, MISO, SCK, CS.


namespace  red_led
 

Red LED output on mbed, used for error messages and debugging when reading and or writing on SD card.


namespace  green_led
 

Green LED output on mbed, used for success messages when reading and or writing on SD card.


namespace  swJoy
 

Switch on potentiomiter.


namespace  xPot
 

AnalogIn that correspods the horizontal movement of the joystick.


namespace  yPot
 

AnalogIn that correspods the virtical movement of the joystick.


namespace  b_A
 

Additional pushbutton (PullDown).


namespace  press_bA
 

IterruptIn corresponding to the pushbutton A (PullDown).


namespace  PWM
 

Pulse width modulation output conected to buzzer to contol the music.


namespace  Ticker_Menu
 

Ticker used for polling the joysick and the digital inputs while the menu funtions are running.


namespace  Ticker_Game
 

Ticker used for polling the joysick and the digital inputs while the game funtion is running.


namespace  Ticker_ds
 

Ticker used to create a more energy efficient wait() funtion.


namespace  tOut
 

Timeout used to implement music.


namespace  Highscores
 

File that stores an array of the top 5 highscores.


namespace  Progress
 

File that stores the progress (i.e unlocked chapeters) of the Story Mode.


Functions

void initialize_values ()
 Initializes all game values so that when the game ends everything returns to it's normal state.
void ticker_wait (int t)
 Waits for t/10 seconds, a more energy efficient but same funtionality as wait()
void generate_random_number ()
 Generates a random munber between 0 and 9999 using the clock on the mbed as a source for the srand() funtion.
void led_bar ()
 Displayes the current number of lives on the led bar.
void play_music ()
 Plays the next note form song1 array on the piezo buzzer.
void Ticker_Menu_isr ()
 Funtion that sets g_Ticker_Menu_flag=1.
void Ticker_Game_isr ()
 Funtion that sets g_Ticker_Game_flag=1.
void Ticker_ds_isr ()
 Funtion that sets g_Ticker_ds_flag=1.
void music_tOut ()
 Funtion that sets PWM.period=0.0, so that the tune stops when it times-out.
void press_b_A_isr ()
 Funtion that sets g_press_b_A_flag=1.
void press_b_B_isr ()
 Funtion that sets g_press_b_B_flag=1.
void calibrateJoystick ()
 Funtion that reads the joystick position when it is still and form those readings it allocates values of xPot and yPot that are equicalent to the directions UP, DOWN, LEFT, RIGHT, CENTRE.
void updateJoystick ()
 Reads the current values of xPot and yPot and detemins the position of the joysick.
void readSD_progress ()
 Reads the Pregress file on the SD card.
void writeSD_progress ()
 Writes the current game progress onto the Progress file on the SD card.
void readSD_and_print_top_score ()
 Reads the Highscores file on the SD card and prints the 5 highest numbers in the Highscores array on the lcd screen.
void writeSD ()
 Writes the topscore on the 6th position in the Highscores array (so it doesn't overwrite any values that are already stored)
void sort_top_scores ()
 Sorts the values and orders them in descending order.
void delete_file (char filename[])
 Funtion to delete a file.
void Delete_Highscores ()
 Delete the Highscores file.
void intro ()
 Prints the name of the game for 3 seconds when it's turned on.
void Credits ()
 Prints the credits on the LCD.
void ground ()
 Prints the floor on the LCD.
void print_heart ()
 Prints the g_heart array on the LCD.
void print_ammo_pickUp ()
 Prints the g_ammo_pickUP on the LCD.
void print_speed_boost ()
 Prints the g_speed_boost on the LCD.
void print_recks_still_gun ()
 Prints Recks (main character), the g_recks_still_gun array on the LCD.
void print_recks_moving_gun ()
 Prints the g_recks_moving_gun array on the LCD.
void print_recks_crouch_gun ()
 Prints the g_recks_crouch_gun array on the LCD.
void print_recks_shield ()
 Prints the g_recks_shield array on the LCD.
void print_recks_jump_gun ()
 Prints the g_recks_jump_gun array on the LCD.
void print_recks_falling ()
 Prints the g_recks_falling array on the LCD.
void print_mob_rat_p1 ()
 Prints the g_mob_rat_p1 (position 1) array on the LCD.
void print_mob_rat_p2 ()
 Prints the g_mob_rat_p2 (position 2) array on the LCD.
void print_mob_hound_p1 ()
 Prints the g_mob_hound_p1 (position 1) array on the LCD.
void print_mob_hound_p2 ()
 Prints the g_mob_hound_p2 (position 2) array on the LCD.
void print_mob_hound_dead ()
 Prints the g_mob_hound_dead array on the LCD.
void print_mob_bear_p1 ()
 Prints the g_mob_bear_p1 (position 1) array on the LCD.
void print_mob_bear_p2 ()
 Prints the g_mob_bear_p2 (position 2) array on the LCD.
void print_mob_bear_dead ()
 Prints the g_mob_bear_dead array on the LCD.
void print_mob_bird_p1 ()
 Prints the g_mob_bird_p1 (position 1) array on the LCD.
void print_mob_bird_p2 ()
 Prints the g_mob_bird_p2 (position 2) array on the LCD.
void print_mob_bird_dead ()
 Prints the g_mob_bear_dead array on the LCD.
void print_cactus ()
 Prints the cactus array on the LCD.
void print_t_rex ()
 Prints the g_t_rex array on the LCD.
void print_t_rex_moving ()
 Prints the g_t_rex_moving array on the LCD.
void print_t_rex_attack ()
 Prints the g_t_rex_attack array on the LCD.
void print_fire_ball_p1 ()
 Prints the g_fire_ball_p1 (position 1) array on the LCD.
void print_fire_ball_p2 ()
 Prints the g_fire_ball_p2 (position 2) array on the LCD.
void print_clouds ()
 Prints the g_clouds array on the LCD.
void print_locks ()
 Prints the g_clouds array on the LCD.
void print_quick_sand ()
 Prints a line of lengh 16 one pixel above the ground.
void falling_animation ()
 Prints animation of Recks sinking in quick sand.
void print_score ()
 Prints "SCORE" and the current score value on the top left of the LCD screen.
void print_ammo ()
 Pritns "AMMO" and the remaining ammo on the top right of the LCD screen.
void main_menu ()
 Funtion that pritns the main menu options and allows the user to select one of the options by pressing the button A.
void Story_Mode ()
 Funtion that pritns the story mode menu options and allows the user to select one of the chapters by pressing the button A or returning to the main menu by pressing the button B.
void Settings ()
 Funtion that pritns the settings menu options and allows the user to select one of the options by pressing the button A or returning to the main menu by pressing the button B.
void Brightness ()
 Funtion that pritns the brightness menu options and allows the user to select one of the different brightnesses by pressing the button A or returning to the main menu by pressing the button B.
void Difficulty ()
 Funtion that pritns the difficulty menu options and allows the user to select one of the different difficulties by pressing the button A or returning to the main menu by pressing the button B.
void Leaderboard ()
 Funtion that allows the user to view the highscores and returning to the main menu by pressing the button B.
void guns ()
 Funtion that pritns the guns options and allows the user to select one of the different guns by pressing the button A or returning to the main menu by pressing the button B.
void Recks ()
 Funtion that contols the motion, physics and interations of Recks with the other interactive elements.
void rat ()
 Funtion that contols the motion, physics and interations of the rat with Recks.
void hound ()
 Funtion that contols the motion, physics and interations of the hound with Recks.
void bear ()
 Funtion that contols the motion, physics and interations of the bear with Recks.
void bird ()
 Funtion that contols the motion, physics and interations of the bird with Recks.
void cactus ()
 Funtion that contols the motion, physics and interations of the cactus with Recks.
void t_rex ()
 Funtion that contols the motion, physics and interations of the T Rex with Recks.
void fire_ball ()
 Funtion that contols the motion, physics and interations of the fire ball with Recks.
void quick_sand ()
 Funtion that contols the motion, physics and interations of the quick sand with Recks.
void heart ()
 Funtion that contols the motion, physics and interations of the heart pickup with Recks.
void pickUp_ammo ()
 Funtion that contols the motion, physics and interations of the ammo pickup with Recks.
void speed_boost ()
 Funtion that contols the motion, physics and interations of the speed boost with Recks.
void shield ()
 Funtion that turns on the shield.
void set_difficulty ()
 This funtion sets flags for printing interactive elements, depending on the difficulty leavel selected.
void Game ()
 Funtion that runs the game.
void Minigame ()
 Funtion that runs the game without the sory mode.
void Tutorial ()
 Funtion that prints sequential text introducing the game, and the game funtions.
void Chapter1 ()
 Funtion that prints sequential text introducing the story and then runs the game on a easy difficulty setting.
void Chapter2 ()
 Funtion that prints sequential text expanding the story and then runs the game on a increased difficulty setting.
void Chapter3 ()
 Funtion that prints sequential text expanding the story and then runs the game on a increased difficulty setting.
void Chapter4 ()
 Funtion that prints sequential text expanding the story and then runs the game with a final boss fight.
int Game_over ()
 Funtion that runs when the lives global variable is 0.
void Pause ()
 Funtion that stops the game and powers down the LED's until the joystick button is pressed.

Variables

int i = 0
int recks_movement = 2
int g_jump = 36
int jumpUp
int accel = 0
int hound_jump = 0
int fall = 37
int bullet = 9
int bullet_height
int menu_select
int menuState = 0
double lives = 4
int score = 0
int kill_score
int shield_score
int shield_counter = 0
int h_movement = 0
int ammo = 24
int g_shoot_loop = 0
int fire_on_screen = 0
int story_mode_flag = 0
int lose_lives_delay_flag = 0
int lives_delay_loop = 0
int difficulty = 2
int story_progress = 1
int g_story_mode_win = 0
int bear_lives = 0
int t_rex_lives = 0
int g_music_count = 1
int g_top_scores [6]
float brightness = 0.5
int random_num
int g_g1
int g_g2
int rat_movement = 95
int hound_hMovement = 98
int hound_vMovement = 40
int bear_movement = 100
int bird_hMovement = 95
int bird_vMovement = 20
int cactus_movement = 110
int t_rex_movement = 120
int quick_sand_movement = 85
int fire_ball_hMovement = t_rex_movement-6
int fire_ball_vMovement = 25
int heart_movement = 90
int ammo_movement = 100
int speed_boost_movement = 130
int jump_flag = 0
int shoot_flag = 0
int shield_flag = 0
int print_rat_flag = 0
int print_hound_flag = 0
int hound_jump_flag = 0
int print_bear_flag = 0
int print_bird_flag = 0
int print_heart_flag = 0
int print_ammo_flag = 0
int print_speed_boost_flag = 0
int print_cactus_flag = 0
int print_t_rex_flag = 0
int print_fire_ball_flag = 0
int print_quick_sand_flag = 0
volatile int g_Ticker_Menu_flag = 0
volatile int g_Ticker_Game_flag = 0
volatile int g_Ticker_Music_flag = 0
volatile int g_Ticker_ds_flag = 0
volatile int g_press_b_A_flag = 0
volatile int g_press_b_B_flag = 0

Detailed Description

Revision 1.0.

Author:
Robin Milward Cooney
Date:
May 2015

Definition in file main.h.


Function Documentation

void bear (  )

Funtion that contols the motion, physics and interations of the bear with Recks.

Definition at line 2458 of file main.cpp.

void bird (  )

Funtion that contols the motion, physics and interations of the bird with Recks.

Definition at line 2494 of file main.cpp.

void Brightness (  )

Funtion that pritns the brightness menu options and allows the user to select one of the different brightnesses by pressing the button A or returning to the main menu by pressing the button B.

Definition at line 2083 of file main.cpp.

void cactus (  )

Funtion that contols the motion, physics and interations of the cactus with Recks.

Definition at line 2538 of file main.cpp.

void calibrateJoystick (  )

Funtion that reads the joystick position when it is still and form those readings it allocates values of xPot and yPot that are equicalent to the directions UP, DOWN, LEFT, RIGHT, CENTRE.

Definition at line 939 of file main.cpp.

void Chapter1 (  )

Funtion that prints sequential text introducing the story and then runs the game on a easy difficulty setting.

Definition at line 1460 of file main.cpp.

void Chapter2 (  )

Funtion that prints sequential text expanding the story and then runs the game on a increased difficulty setting.

Definition at line 1690 of file main.cpp.

void Chapter3 (  )

Funtion that prints sequential text expanding the story and then runs the game on a increased difficulty setting.

Definition at line 1751 of file main.cpp.

void Chapter4 (  )

Funtion that prints sequential text expanding the story and then runs the game with a final boss fight.

Definition at line 1829 of file main.cpp.

void Credits (  )

Prints the credits on the LCD.

Definition at line 2216 of file main.cpp.

void delete_file ( char  filename[] )

Funtion to delete a file.

Parameters:
filename[]- Name of file that is to be deleted

Definition at line 206 of file main.cpp.

void Delete_Highscores (  )

Delete the Highscores file.

Definition at line 221 of file main.cpp.

void Difficulty (  )

Funtion that pritns the difficulty menu options and allows the user to select one of the different difficulties by pressing the button A or returning to the main menu by pressing the button B.

Definition at line 2030 of file main.cpp.

void falling_animation (  )

Prints animation of Recks sinking in quick sand.

Definition at line 872 of file main.cpp.

void fire_ball (  )

Funtion that contols the motion, physics and interations of the fire ball with Recks.

Definition at line 2592 of file main.cpp.

void Game (  )

Funtion that runs the game.

Definition at line 2724 of file main.cpp.

int Game_over (  )

Funtion that runs when the lives global variable is 0.

Printing a game over message

Returns:
0 or 1. 0 returns back to the main menu and 1 re-plays the game after initializing values

Definition at line 2990 of file main.cpp.

void generate_random_number (  )

Generates a random munber between 0 and 9999 using the clock on the mbed as a source for the srand() funtion.

Definition at line 292 of file main.cpp.

void ground (  )

Prints the floor on the LCD.

Definition at line 309 of file main.cpp.

void guns (  )

Funtion that pritns the guns options and allows the user to select one of the different guns by pressing the button A or returning to the main menu by pressing the button B.

Definition at line 2154 of file main.cpp.

void heart (  )

Funtion that contols the motion, physics and interations of the heart pickup with Recks.

Definition at line 2656 of file main.cpp.

void hound (  )

Funtion that contols the motion, physics and interations of the hound with Recks.

Definition at line 2397 of file main.cpp.

void initialize_values (  )

Initializes all game values so that when the game ends everything returns to it's normal state.

Definition at line 41 of file main.cpp.

void intro (  )

Prints the name of the game for 3 seconds when it's turned on.

Definition at line 887 of file main.cpp.

void Leaderboard (  )

Funtion that allows the user to view the highscores and returning to the main menu by pressing the button B.

Definition at line 2136 of file main.cpp.

void led_bar (  )

Displayes the current number of lives on the led bar.

Definition at line 300 of file main.cpp.

void main_menu (  )

Funtion that pritns the main menu options and allows the user to select one of the options by pressing the button A.

Definition at line 970 of file main.cpp.

void Minigame (  )

Funtion that runs the game without the sory mode.

Definition at line 1035 of file main.cpp.

void music_tOut (  )

Funtion that sets PWM.period=0.0, so that the tune stops when it times-out.

Definition at line 918 of file main.cpp.

void Pause (  )

Funtion that stops the game and powers down the LED's until the joystick button is pressed.

Definition at line 2869 of file main.cpp.

void pickUp_ammo (  )

Funtion that contols the motion, physics and interations of the ammo pickup with Recks.

Definition at line 2672 of file main.cpp.

void play_music (  )

Plays the next note form song1 array on the piezo buzzer.

Definition at line 273 of file main.cpp.

void press_b_A_isr (  )

Funtion that sets g_press_b_A_flag=1.

Definition at line 925 of file main.cpp.

void press_b_B_isr (  )

Funtion that sets g_press_b_B_flag=1.

Definition at line 932 of file main.cpp.

void print_ammo (  )

Pritns "AMMO" and the remaining ammo on the top right of the LCD screen.

Definition at line 3022 of file main.cpp.

void print_ammo_pickUp (  )

Prints the g_ammo_pickUP on the LCD.

Definition at line 370 of file main.cpp.

void print_cactus (  )

Prints the cactus array on the LCD.

Definition at line 709 of file main.cpp.

void print_clouds (  )

Prints the g_clouds array on the LCD.

Definition at line 825 of file main.cpp.

void print_fire_ball_p1 (  )

Prints the g_fire_ball_p1 (position 1) array on the LCD.

Definition at line 789 of file main.cpp.

void print_fire_ball_p2 (  )

Prints the g_fire_ball_p2 (position 2) array on the LCD.

Definition at line 807 of file main.cpp.

void print_heart (  )

Prints the g_heart array on the LCD.

Definition at line 352 of file main.cpp.

void print_locks (  )

Prints the g_clouds array on the LCD.

It prints it multiple times next to the corresponding chapter. They are either locked or unlocked depending on the story_progress value

Definition at line 841 of file main.cpp.

void print_mob_bear_dead (  )

Prints the g_mob_bear_dead array on the LCD.

Definition at line 641 of file main.cpp.

void print_mob_bear_p1 (  )

Prints the g_mob_bear_p1 (position 1) array on the LCD.

Definition at line 605 of file main.cpp.

void print_mob_bear_p2 (  )

Prints the g_mob_bear_p2 (position 2) array on the LCD.

Definition at line 623 of file main.cpp.

void print_mob_bird_dead (  )

Prints the g_mob_bear_dead array on the LCD.

Definition at line 695 of file main.cpp.

void print_mob_bird_p1 (  )

Prints the g_mob_bird_p1 (position 1) array on the LCD.

Definition at line 659 of file main.cpp.

void print_mob_bird_p2 (  )

Prints the g_mob_bird_p2 (position 2) array on the LCD.

Definition at line 677 of file main.cpp.

void print_mob_hound_dead (  )

Prints the g_mob_hound_dead array on the LCD.

Definition at line 587 of file main.cpp.

void print_mob_hound_p1 (  )

Prints the g_mob_hound_p1 (position 1) array on the LCD.

Definition at line 551 of file main.cpp.

void print_mob_hound_p2 (  )

Prints the g_mob_hound_p2 (position 2) array on the LCD.

Definition at line 569 of file main.cpp.

void print_mob_rat_p1 (  )

Prints the g_mob_rat_p1 (position 1) array on the LCD.

Definition at line 515 of file main.cpp.

void print_mob_rat_p2 (  )

Prints the g_mob_rat_p2 (position 2) array on the LCD.

Definition at line 533 of file main.cpp.

void print_quick_sand (  )

Prints a line of lengh 16 one pixel above the ground.

Definition at line 727 of file main.cpp.

void print_recks_crouch_gun (  )

Prints the g_recks_crouch_gun array on the LCD.

Definition at line 443 of file main.cpp.

void print_recks_falling (  )

Prints the g_recks_falling array on the LCD.

Definition at line 497 of file main.cpp.

void print_recks_jump_gun (  )

Prints the g_recks_jump_gun array on the LCD.

Definition at line 479 of file main.cpp.

void print_recks_moving_gun (  )

Prints the g_recks_moving_gun array on the LCD.

Definition at line 424 of file main.cpp.

void print_recks_shield (  )

Prints the g_recks_shield array on the LCD.

Definition at line 461 of file main.cpp.

void print_recks_still_gun (  )

Prints Recks (main character), the g_recks_still_gun array on the LCD.

Definition at line 405 of file main.cpp.

void print_score (  )

Prints "SCORE" and the current score value on the top left of the LCD screen.

Definition at line 3169 of file main.cpp.

void print_speed_boost (  )

Prints the g_speed_boost on the LCD.

Definition at line 388 of file main.cpp.

void print_t_rex (  )

Prints the g_t_rex array on the LCD.

Definition at line 735 of file main.cpp.

void print_t_rex_attack (  )

Prints the g_t_rex_attack array on the LCD.

Definition at line 771 of file main.cpp.

void print_t_rex_moving (  )

Prints the g_t_rex_moving array on the LCD.

Definition at line 753 of file main.cpp.

void quick_sand (  )

Funtion that contols the motion, physics and interations of the quick sand with Recks.

Definition at line 2637 of file main.cpp.

void rat (  )

Funtion that contols the motion, physics and interations of the rat with Recks.

Definition at line 2369 of file main.cpp.

void readSD_and_print_top_score (  )

Reads the Highscores file on the SD card and prints the 5 highest numbers in the Highscores array on the lcd screen.

Definition at line 159 of file main.cpp.

void readSD_progress (  )

Reads the Pregress file on the SD card.

Definition at line 124 of file main.cpp.

void Recks (  )

Funtion that contols the motion, physics and interations of Recks with the other interactive elements.

Definition at line 2240 of file main.cpp.

void set_difficulty (  )

This funtion sets flags for printing interactive elements, depending on the difficulty leavel selected.

Definition at line 2891 of file main.cpp.

void Settings (  )

Funtion that pritns the settings menu options and allows the user to select one of the options by pressing the button A or returning to the main menu by pressing the button B.

Definition at line 1982 of file main.cpp.

void shield (  )

Funtion that turns on the shield.

Definition at line 2705 of file main.cpp.

void sort_top_scores (  )

Sorts the values and orders them in descending order.

Definition at line 256 of file main.cpp.

void speed_boost (  )

Funtion that contols the motion, physics and interations of the speed boost with Recks.

Definition at line 2689 of file main.cpp.

void Story_Mode (  )

Funtion that pritns the story mode menu options and allows the user to select one of the chapters by pressing the button A or returning to the main menu by pressing the button B.

Definition at line 1052 of file main.cpp.

void t_rex (  )

Funtion that contols the motion, physics and interations of the T Rex with Recks.

Definition at line 2558 of file main.cpp.

void Ticker_ds_isr (  )

Funtion that sets g_Ticker_ds_flag=1.

Definition at line 911 of file main.cpp.

void Ticker_Game_isr (  )

Funtion that sets g_Ticker_Game_flag=1.

Definition at line 904 of file main.cpp.

void Ticker_Menu_isr (  )

Funtion that sets g_Ticker_Menu_flag=1.

Definition at line 897 of file main.cpp.

void ticker_wait ( int  t )

Waits for t/10 seconds, a more energy efficient but same funtionality as wait()

Parameters:
t- time in 0.1*seconds

Definition at line 112 of file main.cpp.

void Tutorial (  )

Funtion that prints sequential text introducing the game, and the game funtions.

Definition at line 1109 of file main.cpp.

void updateJoystick (  )

Reads the current values of xPot and yPot and detemins the position of the joysick.

Definition at line 946 of file main.cpp.

void writeSD (  )

Writes the topscore on the 6th position in the Highscores array (so it doesn't overwrite any values that are already stored)

Definition at line 187 of file main.cpp.

void writeSD_progress (  )

Writes the current game progress onto the Progress file on the SD card.

Definition at line 141 of file main.cpp.


Variable Documentation

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

Definition at line 150 of file main.h.

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

Definition at line 167 of file main.h.

int ammo_movement = 100

Global variable indicating the horizontal movement of the fire ball made by the ammo pick up

Definition at line 201 of file main.h.

int bear_lives = 0

Global vairable that indicates the number of bullets taken by the bear/3

Definition at line 177 of file main.h.

int bear_movement = 100

Global variable indicating the horizontal movement of the bear

Definition at line 192 of file main.h.

int bird_hMovement = 95

Global variable indicating the horizontal movement of the bird

Definition at line 193 of file main.h.

int bird_vMovement = 20

Global variable indicating the vertical movement of the bird

Definition at line 194 of file main.h.

float brightness = 0.5

Global vairable that indicated the brighntness of the lcd screen

Definition at line 181 of file main.h.

int bullet = 9

Global variable that deffines the horizontal possition of the bullet

Definition at line 153 of file main.h.

Global variable that deffines the vertical possition of the bullet

Definition at line 154 of file main.h.

int cactus_movement = 110

Global variable indicating the horizontal movement of the cactus

Definition at line 195 of file main.h.

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

Definition at line 174 of file main.h.

int fall = 37

Variable that deffines the vertical possition of Recks when he is in Quick sand, decreases at a constant velocity

Definition at line 152 of file main.h.

Global variable indicating the horizontal movement of the fire ball made by the T Rex

Definition at line 198 of file main.h.

Global variable indicating the vertical movement of the fire ball made by the T Rex

Definition at line 199 of file main.h.

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

Definition at line 169 of file main.h.

int g_g1

Global vaiable that is is 1 when the players selects revolver

Definition at line 183 of file main.h.

int g_g2

Global vaiable that is is 1 when the players selects rifle

Definition at line 184 of file main.h.

int g_jump = 36

Global variable that deffines the vertical possition of Recks and the bullet during the jumping action

Definition at line 148 of file main.h.

int g_music_count = 1

Global vairable that indicates the location of the note in the song array

Definition at line 179 of file main.h.

volatile int g_press_b_A_flag = 0

Global variable to flag the Interrupt of button A

Definition at line 231 of file main.h.

volatile int g_press_b_B_flag = 0

Global variable to flag the Interrupt of button B

Definition at line 232 of file main.h.

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

Definition at line 168 of file main.h.

Global variable that indicates whether the final chapter is complete

Definition at line 176 of file main.h.

volatile int g_Ticker_ds_flag = 0

Global variable to flag the ticker for the ticker wait funtion

Definition at line 230 of file main.h.

volatile int g_Ticker_Game_flag = 0

Global variable to flag the game ticker

Definition at line 228 of file main.h.

volatile int g_Ticker_Menu_flag = 0

Global variable to flag the menu ticker

Definition at line 227 of file main.h.

volatile int g_Ticker_Music_flag = 0

Global variable to flag the music ticker

Definition at line 229 of file main.h.

int g_top_scores[6]

Global array that stores the 6 top scores, only the 5 highest are printed

Definition at line 180 of file main.h.

int h_movement = 0

Global variable that counts the distance travelled by Recks, and is used to contol the horizontal possition of the clouds. Diffrent to recks_movement in order so the forgrond can move faster than than the background giving it a sense of perspective. Also used to calcualte the score.

Definition at line 163 of file main.h.

int heart_movement = 90

Global variable indicating the horizontal movement of the fire ball made by the heart pick up

Definition at line 200 of file main.h.

int hound_hMovement = 98

Global variable indicating the horizontal movement of the hound

Definition at line 190 of file main.h.

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

Definition at line 151 of file main.h.

int hound_jump_flag = 0

Global variable that flags (=1) randomly to make the hound jump. It unflags(=0) when the jump is over

Definition at line 214 of file main.h.

int hound_vMovement = 40

Global variable indicating the vertical movement of the hound

Definition at line 191 of file main.h.

int i = 0

Loop counter for the game() funtion

Definition at line 146 of file main.h.

int jump_flag = 0

Global variable that flags (=1) when the jump button is pressed and unflags(=0) when the jump has finished

Definition at line 209 of file main.h.

int jumpUp

Global variable that flags depending on the direction of Recks while jumping. 0 when going up, 1 when going down

Definition at line 149 of file main.h.

Global variable inticating the number of points achieved duning by destroying the mobsr

Definition at line 160 of file main.h.

double lives = 4

Global variable that indicates the number of lives Recks has

Definition at line 157 of file main.h.

Global variable indicating the number of times the lose_lives_delay_flag statement has iterated, after a certain numeer of itterations it resets the flag and the value to 0. Mening the revovery time is over

Definition at line 172 of file main.h.

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

Definition at line 171 of file main.h.

Global variable, it the output of the fsm that deffines what item on the menus have been selected

Definition at line 155 of file main.h.

int menuState = 0

Global variable, it is the current state of the fsm

Definition at line 156 of file main.h.

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

Definition at line 218 of file main.h.

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

Definition at line 215 of file main.h.

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

Definition at line 216 of file main.h.

Global variable that flags (=1) randomly and prints the cactus onscreen. It unflags(=0) when the cactus leaves the screen

Definition at line 220 of file main.h.

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

Definition at line 222 of file main.h.

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

Definition at line 217 of file main.h.

Global variable that flags (=1) randomly and prints the hound onscreen. It unflags(=0) when the hound leaves the screen or is destroyed

Definition at line 213 of file main.h.

Global variable that flags (=1) randomly and prints the quicksand onscreen. It unflags(=0) when the quicksand leaves the screen

Definition at line 223 of file main.h.

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

Definition at line 212 of file main.h.

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

Definition at line 219 of file main.h.

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

Definition at line 221 of file main.h.

Global variable indicating the horizontal movement of the Quick sand

Definition at line 197 of file main.h.

Global vairable, random number created in the generate_random_number() funtion

Definition at line 182 of file main.h.

int rat_movement = 95

Global variable indicating the horizontal movement of the rat

Definition at line 189 of file main.h.

int recks_movement = 2

Global variable that deffines the direction of all mobs with respect to Recks (main character)

Definition at line 147 of file main.h.

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. Score=h_movement/10+killscore-shield_score

Definition at line 158 of file main.h.

int shield_counter = 0

Global variable that counts the number of loops the shield has been "On" for

Definition at line 162 of file main.h.

int shield_flag = 0

Global variable that flags (=1) when the shield is activated (joystick pointed upwards)and unflags(=0) after 1 second

Definition at line 211 of file main.h.

Global variable counting the ammount of times the shield has been used and for every time it decreases the overall score by 10 points

Definition at line 161 of file main.h.

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

Definition at line 210 of file main.h.

Global variable indicating the horizontal movement of the fire ball made by the speed boost pick up

Definition at line 202 of file main.h.

int story_mode_flag = 0

Global variable that flags when the player is in the story mode, rather than in the minigame

Definition at line 170 of file main.h.

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

Definition at line 175 of file main.h.

int t_rex_lives = 0

Global vairable that indicates the number of bullets taken by the T Rex/3

Definition at line 178 of file main.h.

int t_rex_movement = 120

Global variable indicating the horizontal movement of the T Rex

Definition at line 196 of file main.h.