-
Notifications
You must be signed in to change notification settings - Fork 0
/
Character.h
47 lines (39 loc) · 1.08 KB
/
Character.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
#pragma once
#include "entity.h"
#include "TextureResource.h"
#include "Animation.h"
#include <SFML\Graphics.hpp>
#include "Timer.h"
enum class CharacterType{BLACK, SILVER, GRAY, YELLOW, ORANGE};
class Character :public Entity
{
public:
static void init();
static void exit();
private:
//All character objects share the textures
static TextureResource * characterSprites;
private:
Timer sinceLastBomb;
std::string name;
Animation animation;
//Locations on the tile
sf::Vector2i previousLoc;
sf::Keyboard::Key leftKey;
sf::Keyboard::Key rightKey;
sf::Keyboard::Key upKey;
sf::Keyboard::Key downKey;
sf::Keyboard::Key bombKey;
void move(float x, float y);
void handleCollision(GameWorld * g);
void syncGeometry();
public:
Character(int x, int y, std::string name_, CharacterType type, sf::Keyboard::Key left, sf::Keyboard::Key up, sf::Keyboard::Key down, sf::Keyboard::Key right, sf::Keyboard::Key bomb);
virtual ~Character();
virtual void tick(float dt, GameWorld * g);
virtual void draw(sf::RenderWindow & w);
virtual void gotHit();
int nBomb;
int power;
float speed;
};