GML Platformer: Making player slide out of a wall when stuck

S

StormBoyPaul

Guest
In my platformer, I have blocks which disappear and reappear. They work just fine, but there is only one problem. Whenever the blocks change as the player is colliding with the disabled block, the player gets stuck and has no way of getting out other than to switch the blocks again. I have been trying to find the solution to this problem, but I haven't been able to find anything that would help. How would I overcome this issue?
 

Nux

GameMaker Staff
GameMaker Dev.
could you not just wait until the player is not within the block before making it reappear? Otherwise make the block intangible by setting some sort of flag to false so in your collision code you don't collide with it, similar to one way platforms.
 
F

FabioF

Guest
in my my opinion the @Nux solution is good, here my example:

Code:
//create event of the block
alarm[0]=90;
YdistanceToCheck=32;

// alarm[0] event of the block

if (player.y-YdistanceToCheck == y ){

disappear =1 // considering that disappearing is controlled by a variable

}else{
disappear=0
}
alarm[0]=90;
 

TheouAegis

Member
with instance_position(x,y,obj_yokublock) //If there is a disappearing block at current position...
other.x += (other.bbox_right - other.bbox_left - bbox_right + bbox_left) div 2 | 1; //move left or right relative to centers of the instances
 
Top