G
GrandpaBaner
Guest
I'm currently developing a game where you can't change your momentum in the air after you jump. When jumping into a wall right now my player's horizontal speed changes to zero.
I can't figure out how to return the player's speed back to the original speed before the collision once they pass the height of the wall. An example game that has what I'm trying to accomplish is Volgarr the Viking.
In the picture, I'd want the red box to follow the path of the blue line to make it easy to land on top of the wall.
Here is the basic code for the collision that I currently have which changes the speed to zero the whole time.
//Horizontal Collision
if (place_meeting(x+hsp, y, obj_block))
{
while(!place_meeting(x+sign(hsp), y, obj_block))
{
x += sign(hsp);
}
hsp = 0;
}
I can't figure out how to return the player's speed back to the original speed before the collision once they pass the height of the wall. An example game that has what I'm trying to accomplish is Volgarr the Viking.
In the picture, I'd want the red box to follow the path of the blue line to make it easy to land on top of the wall.
Here is the basic code for the collision that I currently have which changes the speed to zero the whole time.
//Horizontal Collision
if (place_meeting(x+hsp, y, obj_block))
{
while(!place_meeting(x+sign(hsp), y, obj_block))
{
x += sign(hsp);
}
hsp = 0;
}
Attachments
-
6.9 KB Views: 3