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