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
Snake/Snake.h@0:d557f30e3a95, 2018-04-30 (annotated)
- Committer:
 - weiway
 - Date:
 - Mon Apr 30 14:10:48 2018 +0000
 - Revision:
 - 0:d557f30e3a95
 - Child:
 - 1:6bcf09972c0d
 
I deleted my previous program , and make a new program as a final submitted project
Who changed what in which revision?
| User | Revision | Line number | New contents of line | 
|---|---|---|---|
| weiway | 0:d557f30e3a95 | 1 | #ifndef SNAKE_H | 
| weiway | 0:d557f30e3a95 | 2 | #define SNAKE_H | 
| weiway | 0:d557f30e3a95 | 3 | |
| weiway | 0:d557f30e3a95 | 4 | |
| weiway | 0:d557f30e3a95 | 5 | #include "mbed.h" | 
| weiway | 0:d557f30e3a95 | 6 | #include "N5110.h" | 
| weiway | 0:d557f30e3a95 | 7 | #include "Gamepad.h" | 
| weiway | 0:d557f30e3a95 | 8 | #include "Fruit.h" | 
| weiway | 0:d557f30e3a95 | 9 | |
| weiway | 0:d557f30e3a95 | 10 | |
| weiway | 0:d557f30e3a95 | 11 | |
| weiway | 0:d557f30e3a95 | 12 | class snake | 
| weiway | 0:d557f30e3a95 | 13 | { | 
| weiway | 0:d557f30e3a95 | 14 | public: | 
| weiway | 0:d557f30e3a95 | 15 | snake(); | 
| weiway | 0:d557f30e3a95 | 16 | ~snake(); | 
| weiway | 0:d557f30e3a95 | 17 | void init(); | 
| weiway | 0:d557f30e3a95 | 18 | void update(Direction d,float mag); | 
| weiway | 0:d557f30e3a95 | 19 | void draw(N5110 &lcd); | 
| weiway | 0:d557f30e3a95 | 20 | void point(); | 
| weiway | 0:d557f30e3a95 | 21 | int get_point(); | 
| weiway | 0:d557f30e3a95 | 22 | Vector2D get_pos(); | 
| weiway | 0:d557f30e3a95 | 23 | void hitwall(); | 
| weiway | 0:d557f30e3a95 | 24 | void eattail(); | 
| weiway | 0:d557f30e3a95 | 25 | int eat_tail; | 
| weiway | 0:d557f30e3a95 | 26 | |
| weiway | 0:d557f30e3a95 | 27 | |
| weiway | 0:d557f30e3a95 | 28 | |
| weiway | 0:d557f30e3a95 | 29 | private: | 
| weiway | 0:d557f30e3a95 | 30 | int _point; | 
| weiway | 0:d557f30e3a95 | 31 | int dir; | 
| weiway | 0:d557f30e3a95 | 32 | int _array; | 
| weiway | 0:d557f30e3a95 | 33 | int _xoldpos[500]; | 
| weiway | 0:d557f30e3a95 | 34 | int _yoldpos[500]; | 
| weiway | 0:d557f30e3a95 | 35 | int _xnewpos[500]; | 
| weiway | 0:d557f30e3a95 | 36 | int _ynewpos[500]; | 
| weiway | 0:d557f30e3a95 | 37 | |
| weiway | 0:d557f30e3a95 | 38 | |
| weiway | 0:d557f30e3a95 | 39 | |
| weiway | 0:d557f30e3a95 | 40 | |
| weiway | 0:d557f30e3a95 | 41 | }; | 
| weiway | 0:d557f30e3a95 | 42 | |
| weiway | 0:d557f30e3a95 | 43 | #endif | 
| weiway | 0:d557f30e3a95 | 44 | |
| weiway | 0:d557f30e3a95 | 45 | |
| weiway | 0:d557f30e3a95 | 46 | |
| weiway | 0:d557f30e3a95 | 47 | |
| weiway | 0:d557f30e3a95 | 48 | |
| weiway | 0:d557f30e3a95 | 49 | |
| weiway | 0:d557f30e3a95 | 50 | |
| weiway | 0:d557f30e3a95 | 51 | |
| weiway | 0:d557f30e3a95 | 52 | |
| weiway | 0:d557f30e3a95 | 53 | |
| weiway | 0:d557f30e3a95 | 54 |