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/main.cpp	Thu Dec 04 03:13:14 2014 +0000
+++ b/main.cpp	Sat Dec 27 23:24:30 2014 +0000
@@ -15,6 +15,7 @@
 static const ImageFrame leftLadderBlock(bmp, 16, 56, 8, 8);
 static const ImageFrame rightLadderBlock(bmp, 24, 56, 8, 8);
 static const ImageFrame wallBlock(bmp, 56, 48, 8, 8);
+static const ImageFrame spikeyPlantBlock(bmp, 32, 56, 8, 8);
 
 // Sprite images
 static const ImageFrame playerWalk1(bmp, 0, 0, 16, 16);
@@ -51,6 +52,7 @@
     Block(&leftLadderBlock, Block::Ladder, 6, 0),       // 6 - Left ladder half - Yellow on black
     Block(&rightLadderBlock, Block::Ladder, 6, 0),      // 7 - Right ladder half - Yellow on black
     Block(&wallBlock, Block::Ladder, 5, 0),             // 8 - Wall - Cyan on black
+    Block(&spikeyPlantBlock, Block::Deadly, 4, 0)       // 9 - Deadly spikey plant block - Green on black
 }; 
 
 // Sprite animation sequences
@@ -81,11 +83,11 @@
     1,0,6,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
     1,0,6,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
     1,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,6,7,4,1,
-    1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,6,7,2,1,
-    1,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,6,7,3,1,
+    1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,7,0,1,
+    1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,7,0,1,
     1,4,6,7,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,1,
-    1,2,6,7,2,2,2,2,2,2,1,2,2,2,2,2,2,2,2,1,
-    1,3,6,7,3,3,3,3,3,3,1,3,3,3,3,3,3,3,3,1,    
+    1,2,6,7,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,
+    1,3,6,7,3,3,9,3,3,3,3,9,3,3,3,3,3,3,3,1,    
     1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
 };
 
@@ -98,13 +100,17 @@
         _enemy2(*this, 4)
     {
         _player.setStartPosition(130, 96);
+        
         _enemy1.setStartPosition(80, 80);
+        _enemy1.setCollisionRect(0, 6, 16, 16);
+        
         _enemy2.setStartPosition(8, 8);        
+        
         setMap(map, 20, 16, blocks, sprites);
         
         addGameObject(&_player);
         addGameObject(&_enemy1);
-        addGameObject(&_enemy2);
+        addGameObject(&_enemy2);            
     }
     
 private:    
@@ -113,19 +119,21 @@
     BouncingEnemy  _enemy2;
     
 protected:
-    virtual void update(float elapsedTime)
-    {
-        Game::update(elapsedTime);
-        wait_ms(32);
+    virtual void update()
+    {        
+        Game::update();
     }
 };
 
+
+MyGame game;  
 int main()
-{
-    DigitalOut led1(P0_9);
-    led1 = 1; 
+{           
+    game.run();
+    while(true)
+    {
+        wait(0.5);
+    }    
     
-    MyGame game;        
-    game.run();
 }
-    
\ No newline at end of file
+