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@17:67dbdfcdcec2, 2020-05-14 (annotated)
- Committer:
- el19tb
- Date:
- Thu May 14 01:07:27 2020 +0000
- Revision:
- 17:67dbdfcdcec2
- Parent:
- 15:b15bf9357cd9
- Child:
- 18:6be4c3c94a3d
created a moving river stream in the last 3 rows of the screen, with different sprites for design
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 | 17:67dbdfcdcec2 | 21 | struct Water |
el19tb | 15:b15bf9357cd9 | 22 | { |
el19tb | 15:b15bf9357cd9 | 23 | char sprite; |
el19tb | 15:b15bf9357cd9 | 24 | int row; |
el19tb | 17:67dbdfcdcec2 | 25 | float speed; |
el19tb | 17:67dbdfcdcec2 | 26 | int x; |
el19tb | 17:67dbdfcdcec2 | 27 | int y; |
el19tb | 15:b15bf9357cd9 | 28 | }; |
el19tb | 15:b15bf9357cd9 | 29 | |
el19tb | 2:86cef2afa648 | 30 | class CrossyChicken { |
el19tb | 11:cc5861abfca5 | 31 | public: |
el19tb | 11:cc5861abfca5 | 32 | |
el19tb | 11:cc5861abfca5 | 33 | Level *local_level; |
el19tb | 15:b15bf9357cd9 | 34 | int row_number; |
el19tb | 17:67dbdfcdcec2 | 35 | |
el19tb | 17:67dbdfcdcec2 | 36 | std::vector<Water> row_water_one; // multiple water objects |
el19tb | 17:67dbdfcdcec2 | 37 | std::vector<Water> row_water_two; // multiple water objects |
el19tb | 17:67dbdfcdcec2 | 38 | std::vector<Water> row_water_three; // multiple water objects |
el19tb | 17:67dbdfcdcec2 | 39 | std::vector<Water>::size_type it; // iterator used to fill the vector |
el19tb | 17:67dbdfcdcec2 | 40 | |
el19tb | 13:cd6d2f999057 | 41 | CrossyChicken(Level *level); |
el19tb | 11:cc5861abfca5 | 42 | |
el19tb | 2:86cef2afa648 | 43 | public: |
el19tb | 2:86cef2afa648 | 44 | void start(); |
el19tb | 2:86cef2afa648 | 45 | void input(); |
el19tb | 2:86cef2afa648 | 46 | void process_input(); |
el19tb | 2:86cef2afa648 | 47 | void clear(); |
el19tb | 2:86cef2afa648 | 48 | |
el19tb | 2:86cef2afa648 | 49 | void game(); |
el19tb | 2:86cef2afa648 | 50 | void refresh(); |
el19tb | 3:648c9d5001be | 51 | |
el19tb | 3:648c9d5001be | 52 | void moveChicken(int xWay, int yWay); |
el19tb | 3:648c9d5001be | 53 | |
el19tb | 5:6e3afee7eac3 | 54 | void moveCar(Car *car, int dir, int x); |
el19tb | 3:648c9d5001be | 55 | void move(); |
el19tb | 3:648c9d5001be | 56 | |
el19tb | 3:648c9d5001be | 57 | void setup(); |
el19tb | 8:52794de935b2 | 58 | void setCollision(Car* object); |
el19tb | 8:52794de935b2 | 59 | void frogOnLog(Car* car); |
el19tb | 8:52794de935b2 | 60 | bool returnCollision(Car* log); |
el19tb | 4:aae7f8d4ab78 | 61 | |
el19tb | 3:648c9d5001be | 62 | private: |
el19tb | 2:86cef2afa648 | 63 | }; |
el19tb | 2:86cef2afa648 | 64 | |
el19tb | 2:86cef2afa648 | 65 | |
el19tb | 2:86cef2afa648 | 66 | #endif |
el19tb | 2:86cef2afa648 | 67 | |
el19tb | 2:86cef2afa648 | 68 | |
el19tb | 2:86cef2afa648 | 69 |