Yufan Zhong / Mbed 2 deprecated GOLD_MINER

Dependencies:   mbed

Revision:
7:5bb5cde8951a
Parent:
1:9c7bb3db32bc
Child:
8:c5969685cf02
--- a/main.cpp	Sat Apr 25 10:41:47 2020 +0000
+++ b/main.cpp	Sun Apr 26 07:30:22 2020 +0000
@@ -25,7 +25,8 @@
 #define WINCH_HEIGHT 6
 #define CLAW_SPEED 3
 #define MONSTER_SIZE 3
-
+#define MONSTER_SPEED 1
+#define GOLD_NUM 9
 /////////////// structs /////////////////
 struct UserInput {
     Direction d;
@@ -34,12 +35,12 @@
 /////////////// objects ///////////////
 N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11);
 Gamepad pad;
-MinerEngine Miner;
+MinerEngine miner;
 
 ///////////// prototypes ///////////////
 void init();
 void update_game(UserInput input);
-void render();
+
 void welcome();
 
 ///////////// functions ////////////////
@@ -56,16 +57,14 @@
 
     init();     // initialise and then display welcome screen...
     welcome();  // waiting for the user to start
-    
-    render();  // first draw the initial frame 
+     // first draw the initial frame 
     wait(1.0f/fps);  // and wait for one frame period
 
 
     // game loop - read input, update the game state and render the display
     while (1) {
-        miner.read_input(pad);
-        miner.update(pad);
-        render();
+        
+         miner.state_switch(pad,lcd);
         wait(1.0f/fps);
     }
 }
@@ -78,23 +77,17 @@
     pad.init();
      
     // initialise the game with correct claw and winch sizes
-    miner.init(WINCH_WIDTH,WINCH_HEIGHT,MONSTER_SIZE,CLAW_SPEED);
+    miner.init(WINCH_WIDTH,WINCH_HEIGHT,GOLD_NUM,MONSTER_SPEED);
 
 }
 
 // this function draws each frame on the LCD
-void render()
-{
-    // clear screen, re-draw and refresh
-    lcd.clear();  
-    miner.draw(lcd);
-    lcd.refresh();
-}
+
 
 // simple splash screen displayed on start-up
 void welcome() {
     
     miner.welcome(pad,lcd);
-    miner.menu(pad,lcd);
+    //miner.menu(pad,lcd);
     
 }
\ No newline at end of file