Finished Lab 4 Pt 1
Dependencies: mbed Sounds PinDetect
Diff: Sprite.h
- Revision:
- 0:daf9e2f8e1a1
diff -r 000000000000 -r daf9e2f8e1a1 Sprite.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Sprite.h Fri Apr 05 19:46:26 2019 +0000 @@ -0,0 +1,32 @@ +#pragma once + +class Sprite +{ +public: + enum enDIRECTIONS {NO_DIR, UP_DIR, DOWN_DIR, LEFT_DIR, RIGHT_DIR}; + // Default Constructor + Sprite(); + // Constructor + Sprite(enDIRECTIONS inDir, unsigned int inRow, unsigned int inCol); + + virtual ~Sprite(){}; + + void SetDesiredDirectionToMove(enDIRECTIONS dir); + + virtual void SetLocation(const int &nRow, const int &nCol) {m_RowPos=nRow;m_ColPos=nCol;}; + + virtual void Move() = 0; + virtual bool IsMoveAllowed(const int &nNewRow, const int &nNewCol) = 0; + virtual int GetImageIndex() {return (m_nActiveImage++)%2;} + +protected: + + enDIRECTIONS m_CurrentDirection; + enDIRECTIONS m_DesiredDirection; + + unsigned int m_RowPos; + unsigned int m_ColPos; + int m_nActiveImage; + + +};