• 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!

GameMaker platform for enemies and player

jonjons

Member
hello
i wanted the player and enemies to be able to go trough platforms without messing each other up
ive made a way of changing the walkable object based on what ground they are on.

the problem here is that the if and the else leave a gap of 1 step, making the objects sometimes locked inside a wall
Code:
if ( place_meeting(x, y-1, obj_Platform) < place_meeting(x, y+22, obj_Platform ) && platGo == 0 ) // 22
{
    wallWalk = instance_place(x, bbox_bottom+5, obj_Platform);
}
else
{
    wallWalk = obj_wall;
}
in this case if the player/enemie is on top of a passable platform and jumps up if there is a wall on top they will get stuck inside a wall

ive also tried to make the code in only one if to close the gap but gm cant retrieve 2 objects at once
var wallCHK = instance_place(x, y+10, ( obj_wall || obj_Platform );
if ( wallCHK != noone )
{
wallWalk = wallCHK;
}
 

TheouAegis

Member
if vspd>0
with instance_place(x,y+vspd obj_platform)
if !place_meeting(x,y,other) {

other.vspd = 0;
other.y += bbox_top - other.bbox_bottom - 1;

}

(Can't remember if the -1 was necessary)
 

jonjons

Member
it seems to work, but a lot of problems have poped up
it seems to be realted with the isOnGround collision

iam using -1 to check if the player is on ground
Code:
if ( place_meeting ( x, y+1, wallWalk) && vsp >= 0 )
{
    grounded = 0;  //----//--plr-stand------------
    vsp = 0;
}
else
{
    grounded = 1;  //----//--plr-onAir----------------
}
for the code to work i have to use if ( place_meeting ( x, y+1, wallWalk) || vsp == 0 )
and the player gets stuck inside a wall if jumping with a wall on top
How is the code checking if the player is on ground or on air ?
 
Last edited:
Top