Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
RallyCar.h
00001 #include "GameObject.h" 00002 00003 #ifndef __RALLYCAR_H__ 00004 #define __RALLYCAR_H__ 00005 class RallyCar : public GameObject 00006 { 00007 public: 00008 RallyCar() : 00009 _direction(Up), 00010 _desiredDirection(Up), 00011 _state(Idle) 00012 { 00013 setCollisionRect(4, 4, 8, 8); 00014 } 00015 00016 enum Direction { Up, Left, Down, Right, None }; 00017 enum State { Idle, Driving, StartSpinning, Spinning, StartCrash, Crashed }; 00018 00019 virtual void reset(){}; 00020 00021 inline Direction getDirection() { return _direction; } 00022 inline void setDirection(Direction direction) { if (_direction != None) _direction = direction; } 00023 00024 inline Direction getDesiredDirection() { return _desiredDirection; } 00025 inline void setDesiredDirection(Direction direction) { if (_desiredDirection != None) _desiredDirection = direction; } 00026 00027 inline void setState(State state) { _state = state; } 00028 inline State getState() { return _state; } 00029 private: 00030 Direction _direction; 00031 Direction _desiredDirection; 00032 State _state; 00033 }; 00034 #endif //__RALLYCAR_H__
Generated on Tue Jul 12 2022 21:15:25 by
