C
Cmtrain
Guest
So I am using Shaun Spalding's platforming engine and after many tries I can't figure out how to get a jump through platform to work. I know Shaun has a tutorial on it but I don't like how it gets rid of the collision box, because I want to have enemies on top of them. If any one haves any ideas I would like to hear them.
Code below.
Code below.
This is in the player object, step event.
dont_move is used to stop the player when they are in a trap.
//Jumping-----------------------------------------------------
if(place_meeting(x,y+1,obj_ground)&& !dont_move){
vsp = key_jump * -jumpspeed;
}
//Horizontal Collision-------------------------------------
if(place_meeting(x+hsp,y,obj_ground)){
while(!place_meeting(x+sign(hsp),y,obj_ground)){
x += sign(hsp);
}
hsp = 0
}
else if(!dont_move)
x += hsp;
//Vertical Collision--------------------------------------
if(place_meeting(x,y+vsp,obj_ground)){
while(!place_meeting(x,y+sign(vsp),obj_ground)){
y += sign(vsp);
}
vsp = 0;
}
else if(!dont_move)
y += vsp;
dont_move is used to stop the player when they are in a trap.
//Jumping-----------------------------------------------------
if(place_meeting(x,y+1,obj_ground)&& !dont_move){
vsp = key_jump * -jumpspeed;
}
//Horizontal Collision-------------------------------------
if(place_meeting(x+hsp,y,obj_ground)){
while(!place_meeting(x+sign(hsp),y,obj_ground)){
x += sign(hsp);
}
hsp = 0
}
else if(!dont_move)
x += hsp;
//Vertical Collision--------------------------------------
if(place_meeting(x,y+vsp,obj_ground)){
while(!place_meeting(x,y+sign(vsp),obj_ground)){
y += sign(vsp);
}
vsp = 0;
}
else if(!dont_move)
y += vsp;