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@42:04e326dcf09b, 2020-05-18 (annotated)
- Committer:
- el19tb
- Date:
- Mon May 18 04:39:06 2020 +0000
- Revision:
- 42:04e326dcf09b
- Parent:
- 37:65c9e5a65738
- Child:
- 43:2cd1cfe07770
worked on lcd class to display items in a structured way, cleaned up engine a bit
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 | |
el19tb | 4:aae7f8d4ab78 | 11 | #include <vector> |
el19tb | 2:86cef2afa648 | 12 | |
el19tb | 29:2151cd327a36 | 13 | class Frogger |
el19tb | 29:2151cd327a36 | 14 | { |
el19tb | 11:cc5861abfca5 | 15 | public: |
el19tb | 29:2151cd327a36 | 16 | |
el19tb | 29:2151cd327a36 | 17 | GraphicEngine *graphics; // local renderer object |
el19tb | 42:04e326dcf09b | 18 | Level *level; // local level object |
el19tb | 29:2151cd327a36 | 19 | Frog *frog; |
el19tb | 37:65c9e5a65738 | 20 | int grid; // size of one game unit |
el19tb | 37:65c9e5a65738 | 21 | |
el19tb | 37:65c9e5a65738 | 22 | Frogger(GraphicEngine *engine, Level *levelptr, Frog *frog, int grid, int w, int h); // constructor |
el19tb | 37:65c9e5a65738 | 23 | |
el19tb | 37:65c9e5a65738 | 24 | public: |
el19tb | 37:65c9e5a65738 | 25 | int current_level; |
el19tb | 29:2151cd327a36 | 26 | |
el19tb | 29:2151cd327a36 | 27 | public: |
el19tb | 29:2151cd327a36 | 28 | |
el19tb | 42:04e326dcf09b | 29 | Gamepad gamepad; // actual hardware object |
el19tb | 42:04e326dcf09b | 30 | |
el19tb | 15:b15bf9357cd9 | 31 | int row_number; |
el19tb | 18:6be4c3c94a3d | 32 | int grid_width; // screen width in grid units |
el19tb | 37:65c9e5a65738 | 33 | int lcd_w; |
el19tb | 37:65c9e5a65738 | 34 | int lcd_h; |
el19tb | 42:04e326dcf09b | 35 | int current_level; |
el19tb | 17:67dbdfcdcec2 | 36 | |
el19tb | 11:cc5861abfca5 | 37 | |
el19tb | 2:86cef2afa648 | 38 | public: |
el19tb | 2:86cef2afa648 | 39 | void start(); |
el19tb | 2:86cef2afa648 | 40 | void input(); |
el19tb | 2:86cef2afa648 | 41 | void process_input(); |
el19tb | 2:86cef2afa648 | 42 | void clear(); |
el19tb | 42:04e326dcf09b | 43 | |
el19tb | 42:04e326dcf09b | 44 | void runCurrentLevel(); |
el19tb | 42:04e326dcf09b | 45 | void initializeLevelTwo(); |
el19tb | 42:04e326dcf09b | 46 | void initializeParams(int w, int h, int grid); |
el19tb | 42:04e326dcf09b | 47 | void initializeEmbeddedSystem(); |
el19tb | 42:04e326dcf09b | 48 | void checkCurrentLevelCollision(); |
el19tb | 42:04e326dcf09b | 49 | void checkIfFrogIsInWater(); |
el19tb | 42:04e326dcf09b | 50 | void moveFrog(int xWay, int yWay); |
el19tb | 2:86cef2afa648 | 51 | void game(); |
el19tb | 2:86cef2afa648 | 52 | void refresh(); |
el19tb | 42:04e326dcf09b | 53 | void createWaterLane(); |
el19tb | 42:04e326dcf09b | 54 | void createMultipleLanesWater(); |
el19tb | 42:04e326dcf09b | 55 | void drawRoadObjects(); |
el19tb | 42:04e326dcf09b | 56 | void createRoadLane(); |
el19tb | 42:04e326dcf09b | 57 | void createMultipleRoadLane(); |
el19tb | 42:04e326dcf09b | 58 | void drawSafety(); |
el19tb | 42:04e326dcf09b | 59 | void createSafetyObject(); |
el19tb | 42:04e326dcf09b | 60 | void createMultipleSafetyLane(); |
el19tb | 42:04e326dcf09b | 61 | |
el19tb | 42:04e326dcf09b | 62 | void drawEndPost(); |
el19tb | 42:04e326dcf09b | 63 | void drawWater(); |
el19tb | 42:04e326dcf09b | 64 | void loopWater(); |
el19tb | 42:04e326dcf09b | 65 | void moveWater(); |
el19tb | 3:648c9d5001be | 66 | |
el19tb | 3:648c9d5001be | 67 | void moveChicken(int xWay, int yWay); |
el19tb | 3:648c9d5001be | 68 | |
el19tb | 5:6e3afee7eac3 | 69 | void moveCar(Car *car, int dir, int x); |
el19tb | 3:648c9d5001be | 70 | void move(); |
el19tb | 3:648c9d5001be | 71 | |
el19tb | 3:648c9d5001be | 72 | void setup(); |
el19tb | 8:52794de935b2 | 73 | void setCollision(Car* object); |
el19tb | 8:52794de935b2 | 74 | void frogOnLog(Car* car); |
el19tb | 42:04e326dcf09b | 75 | bool returnCollision(Car* log); |
el19tb | 42:04e326dcf09b | 76 | void createGoalPost(); |
el19tb | 2:86cef2afa648 | 77 | }; |
el19tb | 2:86cef2afa648 | 78 | |
el19tb | 2:86cef2afa648 | 79 | |
el19tb | 2:86cef2afa648 | 80 | #endif |
el19tb | 2:86cef2afa648 | 81 | |
el19tb | 2:86cef2afa648 | 82 | |
el19tb | 2:86cef2afa648 | 83 |