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.

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Block.h Source File

Block.h

00001 #ifndef __BLOCK_H__
00002 #define __BLOCK_H__
00003 
00004 class Block
00005 {
00006 public:
00007     enum Type { Background, Foreground, Platform, Solid, Ladder, Deadly, Pickup }; 
00008     
00009 public:
00010     Block(const ImageFrame *frame, Type type, uint8_t foregroundColor, uint8_t backgroundColor) :
00011         _frame(frame),
00012         _type(type),
00013         _color((foregroundColor << 4) | backgroundColor),
00014         _data(0)
00015     {
00016     }
00017     
00018     Block(const ImageFrame *frame, Type type, uint8_t foregroundColor, uint8_t backgroundColor, uint8_t data) :
00019         _frame(frame),
00020         _type(type),
00021         _color((foregroundColor << 4) | backgroundColor),
00022         _data(data)
00023     {
00024     }
00025     
00026     inline uint8_t* getBits(int row) const { return _frame->getBits(row); }        
00027     inline uint8_t getForegroundColor() const { return _color >> 4; }    
00028     inline uint8_t getBackgroundColor() const { return _color & 0x0f; }    
00029     inline uint8_t getData() const { return _data; }
00030     inline Type getType() const { return (Type)_type; }
00031     
00032 private:
00033     const ImageFrame    *_frame;
00034     uint8_t             _type;
00035     uint8_t             _color;  
00036     uint8_t             _data;  
00037 };
00038 
00039 #endif //__BLOCK_H__
00040 
00041