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:
3:a93fe5f207f5
Parent:
2:97d01ba6cd91
Child:
4:45ff7fc8a431
--- a/Player.h	Thu Dec 04 03:13:14 2014 +0000
+++ b/Player.h	Sat Dec 27 23:24:30 2014 +0000
@@ -1,3 +1,7 @@
+CREATE_EFFECT(effect1)
+    TONE(40, 1400, 16384, -20077, 128, 0),    
+END_EFFECT
+
 class Player : public GameObject
 {
 public:
@@ -9,6 +13,7 @@
         _jumpY(0),
         _jumpX(0)
     {
+        setCollisionRect(2, 0, 11, 16);
     }
 
     void alignX()
@@ -16,8 +21,8 @@
         if (getX() % 8 != 0)
         {
             int8_t dx = getLastXDirection();
-            if (dx == -1) moveLeft();
-            else if (dx == 1) moveRight();
+            if (dx < 0) moveLeft();
+            else if (dx > 0) moveRight();
         }        
     }
     
@@ -52,7 +57,8 @@
                 if (_state != OnLadder || _jumpX != 0)
                 {
                     _state = Jumping;
-                    _jumpY = 0;      
+                    _jumpY = 0;   
+                    PLAY_EFFECT(effect1);   
                 }            
             }
             
@@ -103,10 +109,10 @@
                         
         if (_state == Jumping)
         {
-            if (_jumpY < 11 && moveUp())
+            if (_jumpY < 10 && moveUp())
             {            
                 ++_jumpY;
-            }                        
+            }                                    
             else if (!moveDown())
             {                
                 _state = Stopped;
@@ -126,10 +132,10 @@
     {
         GameObject::draw();
         
-        if (detectCollision() != NULL)
+        if (detectCollision() != NULL || detectBlock()->getType() == Block::Deadly)
         {
-            Game::Screen.drawRect(getX(), getY(), getX() + 15, getY() + 15, Color565::Green);
-        }                  
+            Game::Surface.drawRect(getX(), getY(), getX() + 15, getY() + 15, Color565::Green);
+        }        
     }
     
 private: