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@15:b15bf9357cd9, 2020-05-13 (annotated)
- Committer:
- el19tb
- Date:
- Wed May 13 22:05:17 2020 +0000
- Revision:
- 15:b15bf9357cd9
- Parent:
- 13:cd6d2f999057
- Child:
- 17:67dbdfcdcec2
created road background, and 4 lanes of roads so vehicles can use
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
el19tb | 2:86cef2afa648 | 1 | #ifndef CROSSYCHICKEN_H |
el19tb | 2:86cef2afa648 | 2 | #define CROSSYCHICKEN_H |
el19tb | 3:648c9d5001be | 3 | |
el19tb | 2:86cef2afa648 | 4 | #include "mbed.h" |
el19tb | 2:86cef2afa648 | 5 | #include "N5110.h" |
el19tb | 2:86cef2afa648 | 6 | #include "Gamepad.h" |
el19tb | 3:648c9d5001be | 7 | #include "Chicken.h" |
el19tb | 3:648c9d5001be | 8 | #include "Car.h" |
el19tb | 11:cc5861abfca5 | 9 | #include "Level.h" |
el19tb | 13:cd6d2f999057 | 10 | #include "Vehicle.h" |
el19tb | 13:cd6d2f999057 | 11 | |
el19tb | 4:aae7f8d4ab78 | 12 | #include <vector> |
el19tb | 2:86cef2afa648 | 13 | |
el19tb | 2:86cef2afa648 | 14 | struct Input{ |
el19tb | 2:86cef2afa648 | 15 | //UP, |
el19tb | 2:86cef2afa648 | 16 | //DOWN, |
el19tb | 2:86cef2afa648 | 17 | //LEFT, |
el19tb | 2:86cef2afa648 | 18 | //RIGHT |
el19tb | 2:86cef2afa648 | 19 | }; |
el19tb | 2:86cef2afa648 | 20 | |
el19tb | 15:b15bf9357cd9 | 21 | struct RoadObjects |
el19tb | 15:b15bf9357cd9 | 22 | { |
el19tb | 15:b15bf9357cd9 | 23 | char sprite; |
el19tb | 15:b15bf9357cd9 | 24 | int row; |
el19tb | 15:b15bf9357cd9 | 25 | }; |
el19tb | 15:b15bf9357cd9 | 26 | |
el19tb | 2:86cef2afa648 | 27 | class CrossyChicken { |
el19tb | 11:cc5861abfca5 | 28 | public: |
el19tb | 11:cc5861abfca5 | 29 | |
el19tb | 11:cc5861abfca5 | 30 | Level *local_level; |
el19tb | 15:b15bf9357cd9 | 31 | int row_number; |
el19tb | 13:cd6d2f999057 | 32 | CrossyChicken(Level *level); |
el19tb | 11:cc5861abfca5 | 33 | |
el19tb | 2:86cef2afa648 | 34 | public: |
el19tb | 2:86cef2afa648 | 35 | void start(); |
el19tb | 2:86cef2afa648 | 36 | void input(); |
el19tb | 2:86cef2afa648 | 37 | void process_input(); |
el19tb | 2:86cef2afa648 | 38 | void clear(); |
el19tb | 2:86cef2afa648 | 39 | |
el19tb | 2:86cef2afa648 | 40 | void game(); |
el19tb | 2:86cef2afa648 | 41 | void refresh(); |
el19tb | 3:648c9d5001be | 42 | |
el19tb | 3:648c9d5001be | 43 | void moveChicken(int xWay, int yWay); |
el19tb | 3:648c9d5001be | 44 | |
el19tb | 5:6e3afee7eac3 | 45 | void moveCar(Car *car, int dir, int x); |
el19tb | 3:648c9d5001be | 46 | void move(); |
el19tb | 3:648c9d5001be | 47 | |
el19tb | 3:648c9d5001be | 48 | void setup(); |
el19tb | 8:52794de935b2 | 49 | void setCollision(Car* object); |
el19tb | 8:52794de935b2 | 50 | void frogOnLog(Car* car); |
el19tb | 8:52794de935b2 | 51 | bool returnCollision(Car* log); |
el19tb | 4:aae7f8d4ab78 | 52 | |
el19tb | 3:648c9d5001be | 53 | private: |
el19tb | 2:86cef2afa648 | 54 | }; |
el19tb | 2:86cef2afa648 | 55 | |
el19tb | 2:86cef2afa648 | 56 | |
el19tb | 2:86cef2afa648 | 57 | #endif |
el19tb | 2:86cef2afa648 | 58 | |
el19tb | 2:86cef2afa648 | 59 | |
el19tb | 2:86cef2afa648 | 60 |