-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlataforma3.cpp
More file actions
48 lines (41 loc) · 1.01 KB
/
Plataforma3.cpp
File metadata and controls
48 lines (41 loc) · 1.01 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
#include "Plataforma3.h"
Plataforma3::Plataforma3()
{
this->x=200;
this->y=330;
*moviendose_para_delante=true;
sprites.push_back(IMG_Load("Assests/plataforma_multiple.png"));
}
Plataforma3::~Plataforma3()
{
//dtor
}
void Plataforma3::logica(Personaje*personaje){
if (*moviendose_para_delante==true)
x++;
else if (*moviendose_para_delante==false)
x--;
if (x==300||x==100)
*moviendose_para_delante=false;
else if (x==150||x==-50)
*moviendose_para_delante=true;
if (personaje->x+18>=x&&personaje->x+18<=x+100&&personaje->y+50>=y-2&&personaje->y+50<y&&personaje->saltar==false){
if (*moviendose_para_delante==false){
personaje->y--;
personaje->x--;
}
else if (*moviendose_para_delante==true){
personaje->y--;
personaje->x++;
}
}else if (personaje->x+18>=x&&personaje->x+18<=x+100&&personaje->y+50>=y-2&&personaje->y+50<y&&
personaje->saltar==true){
personaje->saltar=false;
personaje->y--;
}
}
void Plataforma3::reset(){
x=200;
y=300;
*moviendose_para_delante=true;
}