#Jump Through Platform in Gamemaker!

9 messages · Page 1 of 1 (latest)

wild barn
#

I have no code example.
But what you basically need to do is: find out whether you're jumping up or falling down.
While jumping up you can ignore the collision check. While falling down you need to make the check.

golden willow
#

but have 2

#

the Ground(He's have the collision anytime and player can't jump through them)

#

and the platformer(the collision in top and player can jump through them)

#

I tried use this code:

ysp+=0.1
sprite_index=sPlayerIdle

if transition==false
{
if keyboard_check(vk_left)
{
    xsp=-1.1
    image_xscale=-1
    sprite_index=sPlayerWalk
}
if keyboard_check(vk_right)
{
    xsp=+1.1
    image_xscale=1
    sprite_index=sPlayerWalk
}
}

if place_meeting(x,y+1,oGHB)
{
    ysp=0
    if keyboard_check(ord("Z")) or keyboard_check(vk_space) or keyboard_check(vk_up)
    {
        ysp=-3.5
    }
}

if place_meeting(x,y+1,oPHB)
{
    if ysp<1
    {
         ysp=0
    if keyboard_check(ord("Z")) or keyboard_check(vk_space) or keyboard_check(vk_up)
    {
        ysp=-3.5
    }
    }
}

if (!place_meeting(x,y+2,oGHB)) or (!place_meeting(x,y+2,oPHB))
{
    sprite_index=sPlayerAir
}

if place_meeting(x,y-1,oGHB)
{
    ysp=0.1
}

move_and_collide(xsp,ysp,oGHB)
move_and_collide(xsp,ysp,oPHB)
#

but the Player are bugged

#

Observation:

oGHB:

o = Object
G = Ground
HB = Hitbox

#

oPHB:

o = Object
P = Platformer
HB = Hitbox