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.
Diff: RetroGameEngine/GameObject.cpp
- Revision:
- 11:9ae9a88a1da8
- Parent:
- 9:34008d8b1cdf
- Child:
- 14:b4884a31069e
diff -r 782e4e9c6b47 -r 9ae9a88a1da8 RetroGameEngine/GameObject.cpp --- a/RetroGameEngine/GameObject.cpp Sun Jan 11 05:41:45 2015 +0000 +++ b/RetroGameEngine/GameObject.cpp Sun Feb 01 00:43:09 2015 +0000 @@ -39,7 +39,7 @@ void GameObject::animate() { - if (_animationCounter++ % 2) + if ((_animationCounter++ % 2) == 0) { _pScene->animate(_spriteId); } @@ -47,7 +47,8 @@ bool GameObject::moveLeft() { - if ((abs(_dx) == _speed) || !canGoLeft(_position.X, _position.Y)) return false; + if (abs(_dx) == _speed) return true; + if (!canGoLeft(_position.X, _position.Y)) return false; _dx -= _speed; _position.X -= _speed; _flipSprite = false; @@ -56,7 +57,8 @@ bool GameObject::moveRight() { - if ((abs(_dx) == _speed) || !canGoRight(_position.X, _position.Y)) return false; + if (abs(_dx) == _speed) return true; + if (!canGoRight(_position.X, _position.Y)) return false; _dx += _speed; _position.X += _speed; _flipSprite = true;