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@15:47ea86f1ed70, 2018-05-07 (annotated)
- Committer:
- weiway
- Date:
- Mon May 07 11:57:22 2018 +0000
- Revision:
- 15:47ea86f1ed70
- Parent:
- 14:9e2ce28b4e63
- Child:
- 20:980b37fde361
the game runs well but the fruit reborn outside of the screen. and the snake would not die even if hit the wall
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| weiway | 10:946a3835a7c7 | 1 | #ifndef SNAKE_H |
| weiway | 10:946a3835a7c7 | 2 | #define SNAKE_H |
| weiway | 10:946a3835a7c7 | 3 | |
| weiway | 10:946a3835a7c7 | 4 | #include "mbed.h" |
| weiway | 10:946a3835a7c7 | 5 | #include "N5110.h" |
| weiway | 10:946a3835a7c7 | 6 | #include "Gamepad.h" |
| weiway | 0:d557f30e3a95 | 7 | class snake |
| weiway | 0:d557f30e3a95 | 8 | { |
| weiway | 1:6bcf09972c0d | 9 | public: |
| weiway | 1:6bcf09972c0d | 10 | |
| weiway | 0:d557f30e3a95 | 11 | snake(); |
| weiway | 1:6bcf09972c0d | 12 | ~snake(); |
| weiway | 0:d557f30e3a95 | 13 | void init(); |
| weiway | 0:d557f30e3a95 | 14 | void update(Direction d,float mag); |
| weiway | 0:d557f30e3a95 | 15 | void draw(N5110 &lcd); |
| weiway | 0:d557f30e3a95 | 16 | Vector2D get_pos(); |
| weiway | 1:6bcf09972c0d | 17 | void set_pos(Vector2D p); |
| weiway | 2:1e90f0ca344c | 18 | void point(); |
| weiway | 2:1e90f0ca344c | 19 | int get_point(); |
| weiway | 15:47ea86f1ed70 | 20 | |
| weiway | 15:47ea86f1ed70 | 21 | private: |
| weiway | 15:47ea86f1ed70 | 22 | |
| weiway | 15:47ea86f1ed70 | 23 | int _point; |
| weiway | 1:6bcf09972c0d | 24 | int _array; |
| weiway | 7:bd4b84e2320e | 25 | int dir_snake; |
| weiway | 1:6bcf09972c0d | 26 | void s(); |
| weiway | 1:6bcf09972c0d | 27 | void n(); |
| weiway | 1:6bcf09972c0d | 28 | void e(); |
| weiway | 15:47ea86f1ed70 | 29 | void w(); |
| weiway | 1:6bcf09972c0d | 30 | int _xoldpos[100]; |
| weiway | 15:47ea86f1ed70 | 31 | int _yoldpos[100]; |
| weiway | 1:6bcf09972c0d | 32 | int _xnewpos[100]; |
| weiway | 1:6bcf09972c0d | 33 | int _ynewpos[100]; |
| weiway | 0:d557f30e3a95 | 34 | }; |
| weiway | 0:d557f30e3a95 | 35 | #endif |
| weiway | 0:d557f30e3a95 | 36 | |
| 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 | |
| weiway | 0:d557f30e3a95 | 44 | |
| weiway | 0:d557f30e3a95 | 45 |