Ellis Blackford Stroud 201155309

Dependencies:   mbed FATFileSystem

Revision:
15:d855e8c666e7
Parent:
14:08ac9aaa34c3
Child:
16:c8d68cbd1ae2
--- a/main.cpp	Wed May 08 14:54:19 2019 +0000
+++ b/main.cpp	Wed May 08 18:51:59 2019 +0000
@@ -42,7 +42,7 @@
             menu.menu_loop(pad, lcd); //main menu screen - loops until user chooses next screen
                 switch (menu.get_screen()) { //uses user choice to enter next loop in menu
                     case START:
-                        menu.start_loop(pad, lcd); //loops until a pressed then game begins
+                        menu.start_loop(pad, lcd); //loops until A pressed then game begins
                         break;
                     case HIGHSCORES:
                         menu.highscores_loop(pad, lcd, sd); //loops until back pressed then returns to main menu screen
@@ -55,7 +55,6 @@
             
             menu.reset_start_game_flag(); //resets start flag to return to menu after course complete 
             golf.init(menu.get_frame_rate()); //initialises golf objects, sets variables for game and sets frame rate
-
             lcd.clear();
             golf.printLevel(lcd);  //Indicating start of game
             lcd.refresh();
@@ -63,13 +62,13 @@
             golf.reset_game_over_flag();
             while(golf.get_game_over_flag() == false){ //Main Game Loop
             
-                if(g_frame_flag) { //If ticker calls isr and ball not in hole
+                if(g_frame_flag) { //If ticker calls isr and game not over
         
                     g_frame_flag = 0; //reset flag
                     lcd.clear(); //clears lcd buffer
-                    golf.read_input(pad); //reads input from gamepad 
+                    golf.read_input(pad); //reads input from gamepad
+                    golf.update_ball(pad, lcd); //moves ball and checks for bounces/shots/holes/game over
                     golf.drawGame(lcd); //draws ball, walls etc. - draws game from previous frame 
-                    golf.update_ball(pad, lcd); //moves ball and checks for bounces/shots/holes/game over
                     golf.check_end_level(lcd, pad, sd); //checks if level comleted and if game over
                     lcd.refresh(); //updates lcd display
                     sleep(); //sleeps mcu until ticker wakes it up
@@ -90,5 +89,7 @@
     pad.init();
     menu.init();
     ticker_frame.attach(&frame_isr,1.0f/menu.get_frame_rate()); //sets up ticker used to control running speed/frame rate
-    lcd.setContrast(0.5f); //can alter this in settings
+    lcd.setContrast(0.55f); //can alter this in settings
+    lcd.setBrightness(1.0f); //can alter this in settings
+
 }
\ No newline at end of file