-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJoueur.h
75 lines (73 loc) · 1.62 KB
/
Joueur.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
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
#ifndef Joueur_H
#define Joueur_H
#include"Raquette.h"
class Joueur
{
public:
Joueur(){};
explicit Joueur(const Joueur &j)
{
*this = j;
};
explicit Joueur(Joueur&& autre) : score(autre.score), nbPoint(autre.nbPoint), nbRetour(autre.nbRetour), direction(autre.direction), r(std::move(autre.r)) {};
const Joueur& operator=(const Joueur &j){
this->r = j.r;
this->score = j.score;
this->nbPoint = j.nbPoint;
this->nbRetour = j.nbRetour;
return *this;
};
~Joueur(){};
inline const Raquette getRaquette() const{
return this->r;
};
inline const Raquette& getRaquetteRef() const{
return this->r;
};
inline const int collisionAvecMur(){
if (r.getY() <= 0){
return -1;
}
else if (r.getY() + r.getLongueur() >= 450){
return 1;
}
return 0;
};
inline void bougerRaquette(const int &valeur){
this->r.setY(valeur);
};
inline void modifierTailleRaquette(const int valeur){
this->r.setLongueur(valeur);
}
inline void modifierTailleRaquette(const double valeur){
this->r.modifierLongueur(valeur);
}
inline void modifierVelociteRaquette(const double valeur){
this->r.modifierVelocite(valeur);
}
inline void setScore(const int valeur){
this->score += valeur;
};
inline void setNbPoint(const int valeur){
this->nbPoint += valeur;
};
inline const int getScore() const{
return this->score;
};
inline const int getNbPoint() const{
return this->nbPoint;
};
inline void setDirection(const int valeur){
this->direction = valeur;
}
inline const int getDirection(){
return this->direction;
}
protected:
Raquette r;
int score;
int nbPoint;
int nbRetour;
int direction;
};
#endif // !Joueur_H