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

Committer:
taylorza
Date:
Wed Jan 28 03:26:07 2015 +0000
Revision:
0:d85c449aca6d
Child:
1:1b8125937f28
Working maze scrolling, pre-maze compression

Who changed what in which revision?

UserRevisionLine numberNew contents of line
taylorza 0:d85c449aca6d 1 #include "GameObject.h"
taylorza 0:d85c449aca6d 2
taylorza 0:d85c449aca6d 3 #ifndef __RALLYCAR_H__
taylorza 0:d85c449aca6d 4 #define __RALLYCAR_H__
taylorza 0:d85c449aca6d 5 class RallyCar : public GameObject
taylorza 0:d85c449aca6d 6 {
taylorza 0:d85c449aca6d 7 public:
taylorza 0:d85c449aca6d 8 RallyCar() :
taylorza 0:d85c449aca6d 9 _direction(Up),
taylorza 0:d85c449aca6d 10 _desiredDirection(Up),
taylorza 0:d85c449aca6d 11 _state(Idle)
taylorza 0:d85c449aca6d 12 {
taylorza 0:d85c449aca6d 13 setCollisionRect(2, 2, 12, 12);
taylorza 0:d85c449aca6d 14 }
taylorza 0:d85c449aca6d 15
taylorza 0:d85c449aca6d 16 enum Direction { Up, Left, Down, Right, None };
taylorza 0:d85c449aca6d 17 enum State { Idle, Driving, StartSpinning, Spinning, StartCrash, Crashed };
taylorza 0:d85c449aca6d 18
taylorza 0:d85c449aca6d 19 virtual void reset(){};
taylorza 0:d85c449aca6d 20
taylorza 0:d85c449aca6d 21 inline Direction getDirection() { return _direction; }
taylorza 0:d85c449aca6d 22 inline void setDirection(Direction direction) { if (_direction != None) _direction = direction; }
taylorza 0:d85c449aca6d 23
taylorza 0:d85c449aca6d 24 inline Direction getDesiredDirection() { return _desiredDirection; }
taylorza 0:d85c449aca6d 25 inline void setDesiredDirection(Direction direction) { if (_desiredDirection != None) _desiredDirection = direction; }
taylorza 0:d85c449aca6d 26
taylorza 0:d85c449aca6d 27 inline void setState(State state) { _state = state; }
taylorza 0:d85c449aca6d 28 inline State getState() { return _state; }
taylorza 0:d85c449aca6d 29 private:
taylorza 0:d85c449aca6d 30 Direction _direction;
taylorza 0:d85c449aca6d 31 Direction _desiredDirection;
taylorza 0:d85c449aca6d 32 State _state;
taylorza 0:d85c449aca6d 33 };
taylorza 0:d85c449aca6d 34 #endif //__RALLYCAR_H__