Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Revision 15:78b28a43dd37, committed 2019-05-09
- 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