"Lost treasure of mBedungu" 100 level puzzle game for RETRO
Dependencies: LCD_ST7735 RetroPlatform mbed
Game/GameScreen.h@0:f5f961973d01, 2015-02-21 (annotated)
- Committer:
- Architect
- Date:
- Sat Feb 21 06:19:29 2015 +0000
- Revision:
- 0:f5f961973d01
- Child:
- 1:dcea5500a32d
Before switching to 16 colors
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Architect | 0:f5f961973d01 | 1 | #ifndef __GAME_SCREEN_H__ |
Architect | 0:f5f961973d01 | 2 | #define __GAME_SCREEN_H__ |
Architect | 0:f5f961973d01 | 3 | |
Architect | 0:f5f961973d01 | 4 | #include "mbed.h" |
Architect | 0:f5f961973d01 | 5 | #include "ScreenBase.h" |
Architect | 0:f5f961973d01 | 6 | |
Architect | 0:f5f961973d01 | 7 | #define CELL_EMPTY 0 |
Architect | 0:f5f961973d01 | 8 | #define CELL_WALL 1 |
Architect | 0:f5f961973d01 | 9 | #define CELL_BARREL 2 |
Architect | 0:f5f961973d01 | 10 | #define CELL_LADDER 3 |
Architect | 0:f5f961973d01 | 11 | #define CELL_KEY 4 |
Architect | 0:f5f961973d01 | 12 | #define CELL_DOOR 5 |
Architect | 0:f5f961973d01 | 13 | #define CELL_LEFT 6 |
Architect | 0:f5f961973d01 | 14 | #define CELL_RIGHT 7 |
Architect | 0:f5f961973d01 | 15 | #define CELL_CRATE 8 |
Architect | 0:f5f961973d01 | 16 | #define CELL_TOTEM 9 |
Architect | 0:f5f961973d01 | 17 | #define CELL_RICK 10 |
Architect | 0:f5f961973d01 | 18 | |
Architect | 0:f5f961973d01 | 19 | |
Architect | 0:f5f961973d01 | 20 | class GameScreen : public ScreenBase |
Architect | 0:f5f961973d01 | 21 | { |
Architect | 0:f5f961973d01 | 22 | int _state; |
Architect | 0:f5f961973d01 | 23 | |
Architect | 0:f5f961973d01 | 24 | uint8_t _maze[64]; |
Architect | 0:f5f961973d01 | 25 | uint8_t _pocket[2]; |
Architect | 0:f5f961973d01 | 26 | |
Architect | 0:f5f961973d01 | 27 | uint8_t _rickX; |
Architect | 0:f5f961973d01 | 28 | uint8_t _rickY; |
Architect | 0:f5f961973d01 | 29 | |
Architect | 0:f5f961973d01 | 30 | uint8_t _totemX; |
Architect | 0:f5f961973d01 | 31 | uint8_t _totemY; |
Architect | 0:f5f961973d01 | 32 | uint8_t _level; |
Architect | 0:f5f961973d01 | 33 | uint8_t _rickDirection; |
Architect | 0:f5f961973d01 | 34 | public: |
Architect | 0:f5f961973d01 | 35 | GameScreen(); |
Architect | 0:f5f961973d01 | 36 | virtual Screen Update(); |
Architect | 0:f5f961973d01 | 37 | |
Architect | 0:f5f961973d01 | 38 | void unpackLevel( int level ); |
Architect | 0:f5f961973d01 | 39 | void resetLevel(); |
Architect | 0:f5f961973d01 | 40 | private: |
Architect | 0:f5f961973d01 | 41 | |
Architect | 0:f5f961973d01 | 42 | void next(); |
Architect | 0:f5f961973d01 | 43 | void moveleft(); |
Architect | 0:f5f961973d01 | 44 | void moveright(); |
Architect | 0:f5f961973d01 | 45 | void moveup(); |
Architect | 0:f5f961973d01 | 46 | void movedown(); |
Architect | 0:f5f961973d01 | 47 | |
Architect | 0:f5f961973d01 | 48 | bool moveto(uint8_t fromX, uint8_t fromY, uint8_t toX, uint8_t toY); |
Architect | 0:f5f961973d01 | 49 | bool fall(uint8_t fromX, uint8_t fromY); |
Architect | 0:f5f961973d01 | 50 | |
Architect | 0:f5f961973d01 | 51 | bool isPocketFull(); |
Architect | 0:f5f961973d01 | 52 | bool isPocketEmpty(); |
Architect | 0:f5f961973d01 | 53 | bool putInPocket( int item ); |
Architect | 0:f5f961973d01 | 54 | bool getKeyFromPocket(); |
Architect | 0:f5f961973d01 | 55 | bool getBarrelFromPocket(); |
Architect | 0:f5f961973d01 | 56 | |
Architect | 0:f5f961973d01 | 57 | void drawSprite(int x, int y, int sprite, bool mirrored = false); |
Architect | 0:f5f961973d01 | 58 | void drawPocket(); |
Architect | 0:f5f961973d01 | 59 | void drawLevel(); |
Architect | 0:f5f961973d01 | 60 | }; |
Architect | 0:f5f961973d01 | 61 | |
Architect | 0:f5f961973d01 | 62 | #endif //__GAME_SCREEN_H_ |