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

BouncingEnemy.h

Committer:
taylorza
Date:
2014-12-04
Revision:
2:97d01ba6cd91
Child:
4:45ff7fc8a431

File content as of revision 2:97d01ba6cd91:

class BouncingEnemy : public GameObject
{
    public:
        BouncingEnemy(Game &game, uint8_t spriteId) :
            GameObject(game),        
            _dx(1),
            _dy(1)
        {
            setSpriteId(spriteId);
            setSpeed(1);            
        }
        
        virtual void update()
        {
            if (_dx > 0) 
            {
                if (!moveRight()) _dx = -1;
            }
            else if (_dx < 0)
            {
                if (!moveLeft()) _dx = 1;
            }
            
            if (_dy > 0) 
            {
                if (!moveDown()) _dy = -1;
            }
            else if (_dy < 0)
            {
                if (!moveUp()) _dy = 1;
            }
            
            animate();
        }
        
    private:        
        int8_t _dx;
        int8_t _dy;
};