Simple starter skeleton for asteroids video game.

Dependencies:   PinDetect

Revision:
3:98aa3db6a48f
Parent:
2:30020ddfccf6
--- a/Sprite.h	Sat Mar 02 16:11:43 2019 +0000
+++ b/Sprite.h	Thu Apr 01 19:10:58 2021 +0000
@@ -1,29 +1,46 @@
 #pragma once
 
+#define NUM_POINTS 12 // reduce if you need to
+
+// Objects are created centered around the origin
+
 class Sprite
 {
 public:
-    enum enDIRECTIONS {NO_DIR, UP_DIR, DOWN_DIR, LEFT_DIR, RIGHT_DIR};
-    // Default Constructor
+    enum SPRITE_TYPES {SHIP, FIRE, SMALL_AST, MEDIUM_AST, LARGE_AST};
     Sprite();
-    // Constructor
-    Sprite(enDIRECTIONS inDir, unsigned int inRow, unsigned int inCol);
+    virtual ~Sprite(){};
     
-    ~Sprite(){};
-    
-    void SetDesiredDirectionToMove(enDIRECTIONS dir);
+    virtual void move();
+    virtual void draw(bool bErase);
+    virtual void addPoint(int x, int y);
+    virtual bool checkCollision(const Sprite &InSprite) = 0;
+    void setColor(int color){m_color = color;}
+    void setNumPoints(int num){m_numPoints = num;} 
     
-        
-    virtual void Move() {}
-    virtual bool IsMoveAllowed() {return false;}
+    virtual bool isValid() { return m_bIsValid;}
+    
     
 protected:
+
+    double m_xCenter, m_yCenter;  // center of mass
+    double m_DirX, m_DirY; // unit vector
+    float m_Velocity;
     
-    enDIRECTIONS m_CurrentDirection;
-    enDIRECTIONS m_DesiredDirection;
+    int m_color;
+    
+    double m_RotationAmount;
+    double m_RotationVelocity; // degrees/sec
+    int m_RotationDirection; // -1 is left, 0 is not rotating , 1 is rotating right   
     
-    unsigned int m_RowPos;
-    unsigned int m_ColPos;
+    int m_numPoints;
     
+    bool m_bIsValid; 
+   
+    double m_xPoints[NUM_POINTS];
+    double m_yPoints[NUM_POINTS];    
     
-};
\ No newline at end of file
+
+};
+
+