R
Ross
Guest
Hey everyone, this is my first post, so I hope it's in the right section. My problem is a bit of an old school one. I've recently tried to add slopes into my Megaman Zero engine. I can dash, walk and land on the slope moving upward and I can also walk down it, but when I jump downward along the slope and land on it, I bounce off. I understand that this is because it won't register that the character object is currently on the slope. The gravity is still set to .25 when it should be 0, Jump (the variable that tests if you're currently in the air) is set to 1 when it should be 0, and the object's vspeed isn't 0 as it should be. I've been trying different methods all day on this problem, but nothing works. Either it will act as if I haven't added any code at all, or it just stays in the position that it collided with the slope at until the object moves up the slope, then it snaps to the ground, plays the step effect and acts as it should. This is driving me absolutely mad, and if anyone has encountered something like this before and found a solution, your help would be greatly appreciated. I can also post the engine here if it would help.
Landing:
if vspeed < 1 && vspeed != 0 Jump = 1
if Land && !place_free(x,y) y -= 1
if Jump && !place_free(x,y+1)
if Land = 0
{
sound_play(snd_step)
Dashing = 0
Land = 1
alarm[0] = 1
}
if Land Jump = 0
And here's the code I'm using to walk regularly:
if keyboard_check_direct(global.Right) && !keyboard_check_direct(global.Left) && !Dashing
{
repeat (Spe)
{
if place_free(x+1,y+1) && gravity = 0{x += 1 y += 1}
else if place_free(x+1,y) x += 1
else if place_free(x+1,y-1) && gravity = 0 {if Slope < 2 {x += 1 y -= 1 Slope += 1} else Slope = 0}
}}
Landing:
if vspeed < 1 && vspeed != 0 Jump = 1
if Land && !place_free(x,y) y -= 1
if Jump && !place_free(x,y+1)
if Land = 0
{
sound_play(snd_step)
Dashing = 0
Land = 1
alarm[0] = 1
}
if Land Jump = 0
And here's the code I'm using to walk regularly:
if keyboard_check_direct(global.Right) && !keyboard_check_direct(global.Left) && !Dashing
{
repeat (Spe)
{
if place_free(x+1,y+1) && gravity = 0{x += 1 y += 1}
else if place_free(x+1,y) x += 1
else if place_free(x+1,y-1) && gravity = 0 {if Slope < 2 {x += 1 y -= 1 Slope += 1} else Slope = 0}
}}
Last edited by a moderator: