• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Character Floats Near Non Solid Objects

B

buhalda

Guest
[edit] To make things short, I have a problem where my character jumps normally everywhere except for in places where there's a non-solid object behind him like a torch. The character jumps just fine on solid objects, stands, walks , and even jumps with consistency except for when there's like a torch behind him, he either glides down from his jump slowly or floats up higher while jumping and touching it.
I'll provide any detail of code you want. Pls help...
 
Last edited by a moderator:
B

buhalda

Guest
It basically goes like this:

CHARACTER OBJECT (visible 1, solid 0, persistent 0, uses physics 0, has no parent)
press up key event:
if position is collision free 0,-1 relative ,only solid:
{
if global.jumping = 0
{
vspeed = -9;
global.jumping = 1;
}
}

step event:
if not (keyboard_check(vk_up))
{
if (place_meeting(x,y+1,obj_solid_32)) //obj_solid_32 is my regular "block" that is solid
{
if (global.jp != 1)
{
global.jumping = 0; //resets so double jumping wouldn't happen
}
}
}

TORCH OBJECT (visible 1, solid 0, persistent 0, uses physics 0, has no parent)
create event:
sprite_index = spr_torch;
image_speed = 0.24;

Thats it. Everything else in the game works just fine except that when he is in front of the torch or door or whatever that's not solid, he glides up higher and longer.
 
B

buhalda

Guest
img5.PNG
Don't worry about the code it has to do with animation. If theres collision-> gravity set to 0. Else gravity dir = 270 , 1. Basically thats the gravity part. if u need it.
 
Top