-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEnemigo2.cpp
More file actions
43 lines (36 loc) · 756 Bytes
/
Enemigo2.cpp
File metadata and controls
43 lines (36 loc) · 756 Bytes
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
#include "Enemigo2.h"
Enemigo2::Enemigo2()
{
this->x=700;
this->y=40;
this->cuadro_actual=0;
sprites.push_back(IMG_Load("Assests/enemigo2/enemigo2_1.png"));
}
Enemigo2::~Enemigo2()
{
//dtor
}
int Enemigo2::atacar(Personaje*personaje){
if (personaje->x+30==x&&personaje->y+25>y&&personaje->y+25<y+60){
personaje->x=0;
personaje->y=435;
reset();
return -1;
}else if (personaje->x-10==x&&personaje->y+25>y&&personaje->y+25<y+60){
personaje->x=0;
personaje->y=435;
reset();
return -1;
}else if (personaje->x+18>x&&personaje->x<x+60&&personaje->y==y+50){
personaje->x=0;
personaje->y=435;
reset();
return -1;
}
return 0;
}
void Enemigo2::reset(){
this->x=700;
this->y=40;
this->cuadro_actual=0;
}