-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEspada.h
47 lines (43 loc) · 1.39 KB
/
Espada.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
#ifndef ESPADA_H
#define ESPADA_H
#include"Intf_Arma.h"
class Espada : public Intf_Arma{
private:
float anguloRotacion=0;
public:
Espada(){
textura.loadFromFile("Assets/espada1.png");
spriteArma.setTexture(textura);
spriteArma.setOrigin(8,35);
}
void setPosicion(Vector2f pos)override{
spriteArma.setPosition(pos.x+20,pos.y);
}
void atacar(RenderWindow & w,vector<unique_ptr<Proyectil>> & disparos, FlyFactory * _fabrica,Vector2f jugador)override{
if(Mouse::isButtonPressed(Mouse::Left)){
if(spriteArma.getRotation()<=90.f){
anguloRotacion+=20.f;
spriteArma.setRotation(anguloRotacion);
}
}
else{
anguloRotacion=0;
spriteArma.setRotation(anguloRotacion);
}
}
};
#endif // ESPADA_H
/*
void atacar(Event & event)override{
if(event.type == Event::MouseButtonPressed){
if(spriteArma.getRotation()<=90.f){
anguloRotacion+=20.f;
spriteArma.setRotation(anguloRotacion);
}
}
else if(event.type ==Event::MouseButtonReleased){
anguloRotacion=0;
spriteArma.setRotation(anguloRotacion);
}
}
*/