/
PlayerEntity.h
53 lines (43 loc) · 1.03 KB
/
PlayerEntity.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#ifndef PLAYERNODE_H
#define PLAYERNODE_H
#include "Core/Rectangle.h"
#include "Core/MapNode.h"
#include "Core/Sprite.h"
#include "EntityDef.h"
#include "EntityFactory.h"
class EntityFactory;
class PlayerEntity : public MapNode
{
private:
static const int ENTITY_WIDTH = 256;
static const int ENTITY_HEIGHT = 108;
static const int ACCEL = 3;
static const int GUN_COOLDOWN_TIME = 6;
static const int MAX_VEL = 10;
static const int NUM_FRAMES = 1;
EntityFactory* factory;
Sprite sprite;
Rectangle* camera;
int xVel;
int yVel;
int startX;
int startY;
int health;
int gunCooldown;
public:
PlayerEntity(Image* image, Map* m, Rectangle* c, int x, int y, EntityFactory* f);
~PlayerEntity();
void moveUp();
void moveDown();
void moveLeft();
void moveRight();
void shoot();
void respawn();
void setSpawn(int x, int y);
int getSpawnX();
void damage(int d);
int getHealth();
void update();
void draw(Rectangle* view, Graphics* g);
};
#endif