rename Character to Sprite, add definitions

This commit is contained in:
2025-03-31 19:11:25 -04:00
parent 2c02593fcd
commit c794b73c81
2 changed files with 47 additions and 27 deletions
-27
View File
@@ -1,27 +0,0 @@
#ifndef CHARACTER_H
#define CHARACTER_H
enum MOVEMENT_DIR {
UP,
DOWN,
LEFT,
RIGHT,
};
class Character {
private:
int worldX;
int worldY;
float posX;
float posY;
MOVEMENT_DIR facing;
int spriteOffset;
int renderLayer;
};
void charMove(MOVEMENT_DIR dir, int *pCharX, int *pCharY);
#endif
+47
View File
@@ -0,0 +1,47 @@
#ifndef SPRITE_H
#define SPRITE_H
enum MOVEMENT_DIR {
UP,
DOWN,
LEFT,
RIGHT,
};
class Sprite {
private:
int worldX;
int worldY;
float posX;
float posY;
float veloX;
float veloY;
MOVEMENT_DIR facing;
bool isMoving;
int spriteOffset;
int renderLayer;
int animationFrame;
public:
Sprite();
void render();
void move();
void tryMove(int newX, int newY);
int getX() const;
int getY() const;
int getAnimFrame() const;
float getPosX() const;
float getPosY() const;
float getVeloX() const;
float getVeloY() const;
MOVEMENT_DIR getDirection() const;
bool getIsMoving() const;
};
#endif