Platform game written for the GHI/OutrageousCircuits RETRO game device. Navigate the caves collecting all the pickups and avoiding the creatures and haunted mine carts that patrol the caves. Oh and remember to watch out for the poisonous plants... This game demonstrates the ability to have multiple animated sprites where the sprites can overlap the background environment. See how the player moves past the fence and climbs the wall in the 3rd screen.
RetroGameEngine/Block.h@9:34008d8b1cdf, 2015-01-11 (annotated)
- Committer:
- taylorza
- Date:
- Sun Jan 11 02:53:03 2015 +0000
- Revision:
- 9:34008d8b1cdf
Final version before optimizations
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
taylorza | 9:34008d8b1cdf | 1 | #ifndef __BLOCK_H__ |
taylorza | 9:34008d8b1cdf | 2 | #define __BLOCK_H__ |
taylorza | 9:34008d8b1cdf | 3 | |
taylorza | 9:34008d8b1cdf | 4 | class Block |
taylorza | 9:34008d8b1cdf | 5 | { |
taylorza | 9:34008d8b1cdf | 6 | public: |
taylorza | 9:34008d8b1cdf | 7 | enum Type { Background, Foreground, Platform, Solid, Ladder, Deadly, Pickup }; |
taylorza | 9:34008d8b1cdf | 8 | |
taylorza | 9:34008d8b1cdf | 9 | public: |
taylorza | 9:34008d8b1cdf | 10 | Block(const ImageFrame *frame, Type type, uint8_t foregroundColor, uint8_t backgroundColor) : |
taylorza | 9:34008d8b1cdf | 11 | _frame(frame), |
taylorza | 9:34008d8b1cdf | 12 | _type(type), |
taylorza | 9:34008d8b1cdf | 13 | _color((foregroundColor << 4) | backgroundColor), |
taylorza | 9:34008d8b1cdf | 14 | _data(0) |
taylorza | 9:34008d8b1cdf | 15 | { |
taylorza | 9:34008d8b1cdf | 16 | } |
taylorza | 9:34008d8b1cdf | 17 | |
taylorza | 9:34008d8b1cdf | 18 | Block(const ImageFrame *frame, Type type, uint8_t foregroundColor, uint8_t backgroundColor, uint8_t data) : |
taylorza | 9:34008d8b1cdf | 19 | _frame(frame), |
taylorza | 9:34008d8b1cdf | 20 | _type(type), |
taylorza | 9:34008d8b1cdf | 21 | _color((foregroundColor << 4) | backgroundColor), |
taylorza | 9:34008d8b1cdf | 22 | _data(data) |
taylorza | 9:34008d8b1cdf | 23 | { |
taylorza | 9:34008d8b1cdf | 24 | } |
taylorza | 9:34008d8b1cdf | 25 | |
taylorza | 9:34008d8b1cdf | 26 | inline uint8_t* getBits(int row) const { return _frame->getBits(row); } |
taylorza | 9:34008d8b1cdf | 27 | inline uint8_t getForegroundColor() const { return _color >> 4; } |
taylorza | 9:34008d8b1cdf | 28 | inline uint8_t getBackgroundColor() const { return _color & 0x0f; } |
taylorza | 9:34008d8b1cdf | 29 | inline uint8_t getData() const { return _data; } |
taylorza | 9:34008d8b1cdf | 30 | inline Type getType() const { return (Type)_type; } |
taylorza | 9:34008d8b1cdf | 31 | |
taylorza | 9:34008d8b1cdf | 32 | private: |
taylorza | 9:34008d8b1cdf | 33 | const ImageFrame *_frame; |
taylorza | 9:34008d8b1cdf | 34 | uint8_t _type; |
taylorza | 9:34008d8b1cdf | 35 | uint8_t _color; |
taylorza | 9:34008d8b1cdf | 36 | uint8_t _data; |
taylorza | 9:34008d8b1cdf | 37 | }; |
taylorza | 9:34008d8b1cdf | 38 | |
taylorza | 9:34008d8b1cdf | 39 | #endif //__BLOCK_H__ |
taylorza | 9:34008d8b1cdf | 40 | |
taylorza | 9:34008d8b1cdf | 41 |