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
Frogger/Frogger.h@29:2151cd327a36, 2020-05-16 (annotated)
- Committer:
- el19tb
- Date:
- Sat May 16 00:33:51 2020 +0000
- Revision:
- 29:2151cd327a36
- Parent:
- CrossyChicken/CrossyChicken.h@19:6d9721ffc078
- Child:
- 37:65c9e5a65738
changed the name of the game, cleaned out files, made the level object and graphic objects be made in the int main() and passed accordingly.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
el19tb | 29:2151cd327a36 | 1 | #ifndef FROGGER_H |
el19tb | 29:2151cd327a36 | 2 | #define FROGGER_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 | 29:2151cd327a36 | 7 | #include "Frog.h" |
el19tb | 29:2151cd327a36 | 8 | #include "WaterObject.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 | 17:67dbdfcdcec2 | 14 | struct Water |
el19tb | 15:b15bf9357cd9 | 15 | { |
el19tb | 19:6d9721ffc078 | 16 | int x; |
el19tb | 15:b15bf9357cd9 | 17 | int row; |
el19tb | 19:6d9721ffc078 | 18 | char c; |
el19tb | 17:67dbdfcdcec2 | 19 | float speed; |
el19tb | 19:6d9721ffc078 | 20 | }; |
el19tb | 19:6d9721ffc078 | 21 | |
el19tb | 19:6d9721ffc078 | 22 | struct Safety |
el19tb | 19:6d9721ffc078 | 23 | { |
el19tb | 17:67dbdfcdcec2 | 24 | int x; |
el19tb | 19:6d9721ffc078 | 25 | int row; |
el19tb | 19:6d9721ffc078 | 26 | char c; |
el19tb | 19:6d9721ffc078 | 27 | }; |
el19tb | 15:b15bf9357cd9 | 28 | |
el19tb | 29:2151cd327a36 | 29 | class Frogger |
el19tb | 29:2151cd327a36 | 30 | { |
el19tb | 11:cc5861abfca5 | 31 | public: |
el19tb | 29:2151cd327a36 | 32 | |
el19tb | 29:2151cd327a36 | 33 | GraphicEngine *graphics; // local renderer object |
el19tb | 29:2151cd327a36 | 34 | Level *level; // local level object |
el19tb | 29:2151cd327a36 | 35 | Frog *frog; |
el19tb | 29:2151cd327a36 | 36 | CrossyChicken(GraphicEngine *engine, Level *level, Frog *frog); // constructor |
el19tb | 29:2151cd327a36 | 37 | |
el19tb | 29:2151cd327a36 | 38 | public: |
el19tb | 29:2151cd327a36 | 39 | |
el19tb | 29:2151cd327a36 | 40 | Gamepad gamepad; |
el19tb | 15:b15bf9357cd9 | 41 | int row_number; |
el19tb | 18:6be4c3c94a3d | 42 | int grid_width; // screen width in grid units |
el19tb | 29:2151cd327a36 | 43 | int screenW; |
el19tb | 29:2151cd327a36 | 44 | int screenH; |
el19tb | 17:67dbdfcdcec2 | 45 | |
el19tb | 18:6be4c3c94a3d | 46 | std::vector<Background> roads; |
el19tb | 19:6d9721ffc078 | 47 | std::vector<Safety> safety_lane; |
el19tb | 19:6d9721ffc078 | 48 | std::vector<Water> water; |
el19tb | 29:2151cd327a36 | 49 | int grid; // size of game unit grids in the screen |
el19tb | 11:cc5861abfca5 | 50 | |
el19tb | 2:86cef2afa648 | 51 | public: |
el19tb | 2:86cef2afa648 | 52 | void start(); |
el19tb | 2:86cef2afa648 | 53 | void input(); |
el19tb | 2:86cef2afa648 | 54 | void process_input(); |
el19tb | 2:86cef2afa648 | 55 | void clear(); |
el19tb | 2:86cef2afa648 | 56 | |
el19tb | 2:86cef2afa648 | 57 | void game(); |
el19tb | 2:86cef2afa648 | 58 | void refresh(); |
el19tb | 3:648c9d5001be | 59 | |
el19tb | 3:648c9d5001be | 60 | void moveChicken(int xWay, int yWay); |
el19tb | 3:648c9d5001be | 61 | |
el19tb | 5:6e3afee7eac3 | 62 | void moveCar(Car *car, int dir, int x); |
el19tb | 3:648c9d5001be | 63 | void move(); |
el19tb | 3:648c9d5001be | 64 | |
el19tb | 3:648c9d5001be | 65 | void setup(); |
el19tb | 8:52794de935b2 | 66 | void setCollision(Car* object); |
el19tb | 8:52794de935b2 | 67 | void frogOnLog(Car* car); |
el19tb | 8:52794de935b2 | 68 | bool returnCollision(Car* log); |
el19tb | 4:aae7f8d4ab78 | 69 | |
el19tb | 3:648c9d5001be | 70 | private: |
el19tb | 2:86cef2afa648 | 71 | }; |
el19tb | 2:86cef2afa648 | 72 | |
el19tb | 2:86cef2afa648 | 73 | |
el19tb | 2:86cef2afa648 | 74 | #endif |
el19tb | 2:86cef2afa648 | 75 | |
el19tb | 2:86cef2afa648 | 76 | |
el19tb | 2:86cef2afa648 | 77 |