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