-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplayer.cpp
60 lines (48 loc) · 999 Bytes
/
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
#include "player.h"
void Player::set_block(void)
{
a = this->get_pos();
b = a + Vector2D(0.0, height_);
}
double Player::getMaxForce() const
{
return max_force_;
}
double Player::getMaxSpeed() const
{
return max_speed_;
}
Player::Player()
:
Player(Vector2D(), Vector2D(), 0.0, 0.0, 0.0)
{
}
Player::Player(const Vector2D &left, const Vector2D &right, double height,
double max_speed, double max_force, double curr)
:
Movable(left, right, (right - left) * curr, Vector2D(0.0, 0.0)),
height_(height),
max_force_(max_force),
max_speed_(max_speed)
{
set_block();
}
Player::~Player()
{
}
void Player::initDefault(const Vector2D &left, const Vector2D &right,
double height, double max_speed, double max_force,
double curr)
{
height_ = height;
max_speed_ = max_speed;
max_force_ = max_force;
Movable::initMovable(left, right, (right - left) * curr + left, Vector2D());
set_block();
}
bool Player::move()
{
bool isOk = Movable::move();
set_block();
return isOk;
}