-
Notifications
You must be signed in to change notification settings - Fork 0
/
Player.hpp
51 lines (46 loc) · 1.22 KB
/
Player.hpp
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
/*
* File: Player.hpp
* Author: iMer
*
* Created on 23. August 2014, 11:04
*/
#ifndef PLAYER_HPP
#define PLAYER_HPP
#include "SpriteNode.hpp"
#include "util/Event.hpp"
class Player;
class PlayerContactListener : public engine::util::EventHandler<b2Contact*, bool> {
protected:
b2Fixture* m_fixture;
size_t m_contactCount;
Player* m_player;
public:
PlayerContactListener(Player* player, b2Fixture* fixture);
virtual void handle(b2Contact* contact, bool begin);
size_t GetContactCount() const;
void SetFixture(b2Fixture* fixture);
};
class Player : public engine::SpriteNode {
protected:
sf::Vector2f m_maxVelocity;
sf::Vector2f m_velocityIncrease;
b2Fixture* m_fixtureRect;
b2Fixture* m_fixtureCircle;
PlayerContactListener m_contactListener;
float m_jumpCooldown;
sf::Vector2f m_spawnPosition;
bool m_killed;
SpriteNode* m_explosion;
float m_shootTimer;
float m_respawnTimer;
bool m_bubble;
public:
Player(engine::Scene* scene);
virtual ~Player();
virtual void OnUpdate(sf::Time interval);
virtual bool initialize(Json::Value& root);
void Kill();
virtual uint8_t GetType() const;
void EnableBubble();
};
#endif /* PLAYER_HPP */