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

Revision:
9:34008d8b1cdf
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/RetroGameEngine/Sprite.h	Sun Jan 11 02:53:03 2015 +0000
@@ -0,0 +1,40 @@
+#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__
+