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

RetroGameEngine/Block.h

Committer:
taylorza
Date:
2015-02-16
Revision:
16:f9227904afc4
Parent:
9:34008d8b1cdf

File content as of revision 16:f9227904afc4:

#ifndef __BLOCK_H__
#define __BLOCK_H__

class Block
{
public:
    enum Type { Background, Foreground, Platform, Solid, Ladder, Deadly, Pickup }; 
    
public:
    Block(const ImageFrame *frame, Type type, uint8_t foregroundColor, uint8_t backgroundColor) :
        _frame(frame),
        _type(type),
        _color((foregroundColor << 4) | backgroundColor),
        _data(0)
    {
    }
    
    Block(const ImageFrame *frame, Type type, uint8_t foregroundColor, uint8_t backgroundColor, uint8_t data) :
        _frame(frame),
        _type(type),
        _color((foregroundColor << 4) | backgroundColor),
        _data(data)
    {
    }
    
    inline uint8_t* getBits(int row) const { return _frame->getBits(row); }        
    inline uint8_t getForegroundColor() const { return _color >> 4; }    
    inline uint8_t getBackgroundColor() const { return _color & 0x0f; }    
    inline uint8_t getData() const { return _data; }
    inline Type getType() const { return (Type)_type; }
    
private:
    const ImageFrame    *_frame;
    uint8_t             _type;
    uint8_t             _color;  
    uint8_t             _data;  
};

#endif //__BLOCK_H__