-
Notifications
You must be signed in to change notification settings - Fork 0
/
Player.cpp
66 lines (53 loc) · 1.16 KB
/
Player.cpp
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
54
55
56
57
58
59
60
61
62
63
64
65
66
#include "Player.hpp"
Player::Player(GameMap &gm) :
_map(gm)
{
_cam = new Camera(glm::vec3(0, 10, 10), glm::vec3(0, 0, 0));
}
Player::~Player() {}
bool Player::initCharacter(std::deque<Bomb *> &objects, int id)
{
static int spawn = 0;
_character = new Character(0, 0, 0, 0, 0, 0, objects, _map, _dead);
if (_character->initialize(id) == false)
throw ErrorException("Error : texture load failed in Character.cpp");
if (id == 1)
spawn = 0;
_character->setPosX(_map.getSpawnX(spawn));
_character->setPosZ(_map.getSpawnZ(spawn));
if (spawn < 7)
++spawn;
return true;
}
Character *Player::getCharacter() const
{
return (_character);
}
bool Player::movePlayer(gdl::Clock const &clock, gdl::Input &input)
{
return (_map.movePlayer(clock, input, *_character));
}
void Player::draw(gdl::AShader &shader, gdl::Clock const &clock)
{
_character->draw(shader, clock);
}
float Player::getPosX()
{
return (_character->getPosX());
}
float Player::getPosZ()
{
return (_character->getPosZ());
}
float Player::getPosY()
{
return (_character->getPosY());
}
bool Player::getDead() const
{
return _dead;
}
Camera *Player::getCamera()
{
return _cam;
}