Yunting Zou 201199716

Dependencies:   mbed MotionSensor

Files at this revision

API Documentation at this revision

Comitter:
zhouyun123
Date:
Thu May 14 17:18:58 2020 +0000
Parent:
2:a2f88b2d5da4
Commit message:
Final Submission. I have read and agreed with Statement of Academic Integrity.

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
viper/viper.h Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Thu May 14 16:42:19 2020 +0000
+++ b/main.cpp	Thu May 14 17:18:58 2020 +0000
@@ -18,7 +18,7 @@
 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 showtarget();      //draw the target food
 void Dead();          //set the failure condition
 void music();         //set the starting music
 void lose();          //set the losing music
@@ -45,7 +45,7 @@
     lcd.clear();
     render();
     viper();
-    drawFood();
+    showtarget();
     Movement();
     gettarget();
     Dead();
@@ -138,7 +138,7 @@
     
     
     //print the food                           5             
-void drawFood(){                                                              //6
+void showtarget(){                                                              //6
     lcd.drawRect(target.var.x,target.var.y,1,1,FILL_TRANSPARENT);
     }
     
--- a/viper/viper.h	Thu May 14 16:42:19 2020 +0000
+++ b/viper/viper.h	Thu May 14 17:18:58 2020 +0000
@@ -14,7 +14,7 @@
 N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11);
 Gamepad pad;
  
-/**STRUCTURE**/
+/**structure**/
 struct vip {      //@set the location of the snake
     int x;
     int y;    
@@ -38,7 +38,7 @@
 int score ;
 int HP;              // Snake's health point(HP), if HP=0, game over.
 int D;               //set the variable of direction
-int d;               //set the variable of the joystick
+int d;               //set the variable for the control of joystick
  
  // define the location of the snake       1
  void defineSnake(){
@@ -52,7 +52,6 @@
 //show a snake by creating array          2
 void viper()
 {
-        
         for(int i = 0; i < SER.n; i++){
         lcd.drawRect(SER.head[i].x,SER.head[i].y,1,1,FILL_TRANSPARENT);
         }