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/Sprite.h

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

File content as of revision 16:f9227904afc4:

#ifndef __SPRITE_H__
#define __SPRITE_H__

class Sprite
{
    public:
        Sprite(const ImageFrame *frames[], uint8_t foregroundColor) :
            _frames(frames),
            _frameCount(0),
            _frameIndex(0),            
            _foregroundColor(foregroundColor)
        {            
            for(;; _frameCount++)
            {
                if (frames[_frameCount] == NULL) break;
            }
            
        }
        
        void animate()
        {
            _frameIndex = (_frameIndex + 1) % _frameCount;  
        }
        
        uint8_t* getBits(int row) const
        {
            return _frames[_frameIndex]->getBits(row);
        }
        
        inline uint16_t getForegroundColor() const { return _foregroundColor; }
        
    private:
        const ImageFrame **_frames;
        uint8_t     _frameCount;
        uint8_t     _frameIndex;        
        uint8_t     _foregroundColor;                                
};

#endif //__SPRITE_H__