Race around the city collecting the flags while avoiding those that stand in the way of your mission. Make no mistake you will need to be quick to outwit your opponents, they are smart and will try to box you in. I wrote this game to prove that writing a game with scrolling scenery is possible even with the limited 6kB of RAM available. I had to compromise sound effects for features, I wanted multiple opponents, I wanted to be able to drop smoke bombs to trap the opponents but all this required memory so the sound effects had to take a back seat.

Dependencies:   mbed

RallyCar.h

Committer:
taylorza
Date:
2015-01-28
Revision:
0:d85c449aca6d
Child:
1:1b8125937f28

File content as of revision 0:d85c449aca6d:

#include "GameObject.h"

#ifndef __RALLYCAR_H__
#define __RALLYCAR_H__
class RallyCar : public GameObject
{
public:
    RallyCar() :
        _direction(Up),
        _desiredDirection(Up),
        _state(Idle)
    {
        setCollisionRect(2, 2, 12, 12);
    }
    
    enum Direction { Up, Left, Down, Right, None };
    enum State  { Idle, Driving, StartSpinning, Spinning, StartCrash, Crashed };
    
    virtual void reset(){};
    
    inline Direction getDirection() { return _direction; }
    inline void setDirection(Direction direction) { if (_direction != None) _direction = direction; }
    
    inline Direction getDesiredDirection() { return _desiredDirection; }
    inline void setDesiredDirection(Direction direction) { if (_desiredDirection != None) _desiredDirection = direction; }
    
    inline void setState(State state) { _state = state; }
    inline State getState() { return _state; }
private:
    Direction _direction;
    Direction _desiredDirection;
    State     _state;    
};
#endif //__RALLYCAR_H__