ELEC2645 (2018/19) / Mbed 2 deprecated el18w2w1

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
wuweilong
Date:
Thu May 09 14:30:53 2019 +0000
Parent:
14:65249a106a6e
Commit message:
last version

Changed in this revision

element/element.h Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/element/element.h	Wed May 08 22:19:27 2019 +0000
+++ b/element/element.h	Thu May 09 14:30:53 2019 +0000
@@ -4,7 +4,7 @@
 #include "mbed.h"
 #include "N5110.h"
 #include "Gamepad.h"
-/** setting class
+/** element class
 * @brief element class 
 * @author WUWEILONG 201282622
 * @date May.2019
--- a/main.cpp	Wed May 08 22:19:27 2019 +0000
+++ b/main.cpp	Thu May 09 14:30:53 2019 +0000
@@ -19,15 +19,15 @@
 element e;
 int main(){
     int n=20;
-    int fps =8;
+    int fps =10;
     init(n);//initialize 
     welcome();
-    render(n);
+    
+   
     wait(1.0f/fps);
     //gameloop 
     while(1){
-        
-        update(n);//update the coodinate
+        update(n);//update the coordinate
         render(n);// draw the graph
         wait(1.0f/fps); 
     }
@@ -91,7 +91,7 @@
     }
  
 } 
-void eat(int &n ){
+void eat(int &n ){//check if  the coordinate of snake and food is the same  
 
     for(int i=0;i<2;i++)
     {
@@ -198,7 +198,7 @@
     }
         
 }
-void hitself(int &n){
+void hitself(int &n){// check if the snake hit itself 
     for(int i=2;i<n;i++)
     {
         for(int j=0;j<2;j++)
@@ -296,4 +296,8 @@
         }
 }
 
+            
+                                                  
+            
+            
             
\ No newline at end of file