Yunting Zou 201199716

Dependencies:   mbed MotionSensor

Revision:
1:9a8033d80067
Parent:
0:047e14f53977
Child:
2:a2f88b2d5da4
--- a/main.cpp	Thu May 14 16:17:30 2020 +0000
+++ b/main.cpp	Thu May 14 16:29:22 2020 +0000
@@ -6,39 +6,39 @@
 Name:Zou yunting
 Username:el17y2z
 Student ID Number:201199716
-Date:May 2019
+Date:15th May 2020
 */
 
 
 #include "viper.h"
 #include "story.h"
 
-void init();          //@ initialise and show the welcome screen
-void begin();         //@ the welcome screen
-void render();        //@ Draw the ouline of the area
-void showviper();     //@Draw the snake
-void speed();         //@select the speed of the snake's movment
-void drawFood();      //@draw the target food
-void Dead();          //@set the failure condition
-void music();         //@set the starting music
-void lose();          //@set the losing music
-int sp = 0 ;          //@variable of speed level
+void init();          // initialise and show the welcome screen
+void begin();         // the welcome screen
+void render();        // Draw the ouline of the area
+void showviper();     //Draw the snake
+void speed();         //select the speed of the snake's movment
+void drawFood();      //draw the target food
+void Dead();          //set the failure condition
+void music();         //set the starting music
+void lose();          //set the losing music
+int sp = 0 ;          //variable of speed level
 
 
  
 int main()
 {
-   //@ the main function of the whole project
+   // the main function of the whole project
     while(1){
-    init();     //@ initialise and show the welcome screen
+    init();     // initialise and show the welcome screen
     begin();
-    music();  //@ show the starting screen
+    music();  // show the starting screen
     firststory();
     graph();
-    speed(); //@ set the speed of snake's movement
+    speed(); // set the speed of snake's movement
     showviper();//@intilize the snake's location
-    viper();//@set the parameter of snake 
-    goal();//@generate the first target food
+    viper();//set the parameter of snake 
+    goal();//generate the first target food
     
    //@ the loop of game, if snake is dead jump to the gameover page
   while(HP == 1 ) {
@@ -52,7 +52,7 @@
     lcd.refresh();
     wait(wtime/2);
     }
-     //@turn to the game over page , press the back button to restart.
+     //turn to the game over page , press the back button to restart.
      while(pad.check_event(Gamepad::BACK_PRESSED) == false){
         gameover();
         lcd.refresh();
@@ -63,13 +63,13 @@
 
 void init()                                                        //1
 {
-    // @ initialise LCD and Gamepad 
+    //  initialise LCD and Gamepad 
     lcd.init();
     pad.init();
      
 }
 
- //@the welcome screen
+ //the welcome screen
 void begin() {                                                    //2
         
     lcd.clear();   
@@ -87,7 +87,7 @@
     }
 }
 
-//@Outline the entire interface
+//Outline the entire interface
 void render() {                                                        //3
    
     lcd.drawRect(0,0,80,40,FILL_TRANSPARENT);
@@ -95,7 +95,7 @@
 }
 
 
-//@initialise the parameters of snake
+//initialise the parameters of snake
 void showviper() {                                                    //4
     SER.head[0].x = 20;
     SER.head[0].y = 30;
@@ -105,7 +105,7 @@
 }
 
 
-// @select the speed of snale's movement by the A and B buttoms
+// select the speed of snale's movement by the A and B buttoms
 void speed(){                                                              //5
     while(pad.check_event(Gamepad::START_PRESSED) == false){
     lcd.clear();
@@ -135,15 +135,15 @@
     }
     
     
-    //@print the food                           5             
+    //print the food                           5             
 void drawFood(){                                                              //6
     lcd.drawRect(target.var.x,target.var.y,1,1,FILL_TRANSPARENT);
     }
     
        
-    //@if the viper rush out of the border of the screen, game over.             7
+    //if the viper rush out of the border of the screen, game over.             7
 void Dead(){
-    //@judge if snake rush out of the border
+    //judge if snake rush out of the border
     if(SER.head[0].x<=0 || SER.head[0].x >= 80 || SER.head[0].y <= 0  || SER.head[0].y >= 40)
     {
         HP = 0;
@@ -151,7 +151,7 @@
     }
     
     
-    //@if snake dead,print gameover screen and prepare to resart                8  
+    //if snake dead,print gameover screen and prepare to resart                8  
 void gameover(){
     lcd.clear();
     lcd.printString("failure!",0,1 );