-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplayer.cpp
More file actions
75 lines (59 loc) · 1.63 KB
/
Copy pathplayer.cpp
File metadata and controls
75 lines (59 loc) · 1.63 KB
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
67
68
69
70
71
72
73
74
75
#include "player.h"
Player::Player(std::string name, double vit, int px, int py, int w, int h, int life, int cad, sf::Image *collision)
: Entite(name,vit,px,py,w,h,life){
connect(&internalClock,SIGNAL(timeout()),this,SLOT(canShoot()));
internalClock.setInterval(cad);
internalClock.start();
connect(&invincibilityTimer,SIGNAL(timeout()),this,SLOT(stopInv()));
invincibilityTimer.setInterval(1000);
collision_map = collision;
}
void Player::move(){
//TODO ou pas
}
//******/SLOTS\*******\\
void Player::left(){
addX(-vitesse);
if(tz.intersection(collision_map,sf::Color::Black))
addX(vitesse);
currentFrame++;
// updateAngle(mousePosX,mousePosY);
}
void Player::right(){
addX(vitesse);
if(tz.intersection(collision_map,sf::Color::Black))
addX(-vitesse);
currentFrame++;
// updateAngle(mousePosX,mousePosY);
}
void Player::up(){
addY(-vitesse);
if(tz.intersection(collision_map,sf::Color::Black))
addY(vitesse);
currentFrame++;
// updateAngle(mousePosX,mousePosY);
}
void Player::down(){
addY(vitesse);
if(tz.intersection(collision_map,sf::Color::Black))
addY(-vitesse);
currentFrame++;
// updateAngle(mousePosX,mousePosY);
}
void Player::updateAngle(int mouseX,int mouseY){
mousePosX = mouseX;
mousePosY = mouseY;
angle = calcAngle(x,y,mouseX,mouseY);
std::cout << angle << std::endl;
}
void Player::stopInv(){
invincible = false;
invincibilityTimer.stop();
nom = "Hero";
}
void Player::invincibility(bool b){
invincible = b;
if(b)
invincibilityTimer.start();
}
//**********************\\