ELEC2645 (2015/16)
/
Dodgemania
Wall dodging game utilising a joystick and Nokia 5110 LCD display
Diff: main.cpp
- Revision:
- 1:26ebbb94cf36
- Parent:
- 0:6b29f9c29a2a
- Child:
- 2:602e9bb053a0
--- a/main.cpp Fri Apr 22 19:38:51 2016 +0000 +++ b/main.cpp Fri Apr 22 23:29:43 2016 +0000 @@ -78,8 +78,8 @@ DirectionName direction; // Direction the wall travels in int random; // randomly generated integer to determine when a wall begins to travel int cooldown; // stops a wall respawning before a certain amount of time - bool moveFlag; // flag to determine if wall is on screen - bool genFlag; // flag to determine if wall has been generated + volatile bool moveFlag; // flag to determine if wall is on screen + volatile bool genFlag; // flag to determine if wall has been generated }; // struct variable for joystick @@ -106,7 +106,7 @@ float g_dt = 1.0F/refresh_rate; // global to store time step (F makes it a float, gets rid of compiler warning) volatile int g_timer_flag = 0; // flag for timer interrupt int printFlag = 0; // flag for printing -int game_over_flag = 0; // flag to signal game over +volatile int game_over_flag = 0; // flag to signal game over int game_start_flag = 0; // flag to start the game int i = 42; // x-coordinate value of player int j = 24; // y-coordinate value of player @@ -219,7 +219,9 @@ g_timer_flag = 0; // clear flag moveWall(); moveBall(); + checkCollision(); + updateScreen(); warning(); debug();