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
CrossyChicken/CrossyChicken.h@8:52794de935b2, 2020-05-12 (annotated)
- Committer:
- el19tb
- Date:
- Tue May 12 05:14:17 2020 +0000
- Revision:
- 8:52794de935b2
- Parent:
- 5:6e3afee7eac3
- Child:
- 11:cc5861abfca5
implemented the attach function so the frog can jump on a log
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
el19tb | 4:aae7f8d4ab78 | 1 | |
el19tb | 2:86cef2afa648 | 2 | #ifndef CROSSYCHICKEN_H |
el19tb | 2:86cef2afa648 | 3 | #define CROSSYCHICKEN_H |
el19tb | 3:648c9d5001be | 4 | |
el19tb | 2:86cef2afa648 | 5 | #include "mbed.h" |
el19tb | 2:86cef2afa648 | 6 | #include "N5110.h" |
el19tb | 2:86cef2afa648 | 7 | #include "Gamepad.h" |
el19tb | 3:648c9d5001be | 8 | #include "Chicken.h" |
el19tb | 3:648c9d5001be | 9 | #include "Car.h" |
el19tb | 4:aae7f8d4ab78 | 10 | #include <vector> |
el19tb | 2:86cef2afa648 | 11 | |
el19tb | 2:86cef2afa648 | 12 | struct Input{ |
el19tb | 2:86cef2afa648 | 13 | //UP, |
el19tb | 2:86cef2afa648 | 14 | //DOWN, |
el19tb | 2:86cef2afa648 | 15 | //LEFT, |
el19tb | 2:86cef2afa648 | 16 | //RIGHT |
el19tb | 2:86cef2afa648 | 17 | }; |
el19tb | 2:86cef2afa648 | 18 | |
el19tb | 2:86cef2afa648 | 19 | class CrossyChicken { |
el19tb | 2:86cef2afa648 | 20 | public: |
el19tb | 2:86cef2afa648 | 21 | void start(); |
el19tb | 2:86cef2afa648 | 22 | void input(); |
el19tb | 2:86cef2afa648 | 23 | void process_input(); |
el19tb | 2:86cef2afa648 | 24 | void clear(); |
el19tb | 2:86cef2afa648 | 25 | |
el19tb | 2:86cef2afa648 | 26 | void game(); |
el19tb | 2:86cef2afa648 | 27 | void refresh(); |
el19tb | 3:648c9d5001be | 28 | |
el19tb | 3:648c9d5001be | 29 | void moveChicken(int xWay, int yWay); |
el19tb | 3:648c9d5001be | 30 | |
el19tb | 5:6e3afee7eac3 | 31 | void moveCar(Car *car, int dir, int x); |
el19tb | 3:648c9d5001be | 32 | void move(); |
el19tb | 3:648c9d5001be | 33 | |
el19tb | 3:648c9d5001be | 34 | void setup(); |
el19tb | 8:52794de935b2 | 35 | void setCollision(Car* object); |
el19tb | 8:52794de935b2 | 36 | void frogOnLog(Car* car); |
el19tb | 8:52794de935b2 | 37 | bool returnCollision(Car* log); |
el19tb | 4:aae7f8d4ab78 | 38 | |
el19tb | 3:648c9d5001be | 39 | private: |
el19tb | 2:86cef2afa648 | 40 | }; |
el19tb | 2:86cef2afa648 | 41 | |
el19tb | 2:86cef2afa648 | 42 | |
el19tb | 2:86cef2afa648 | 43 | #endif |
el19tb | 2:86cef2afa648 | 44 | |
el19tb | 2:86cef2afa648 | 45 | |
el19tb | 2:86cef2afa648 | 46 |