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

Is there any way to check if a player gets stuck (crushed)?

J

JopRillos2001

Guest
I made a platformer with moving platforms, but there is an issue.
When I get between the moving platform and a solig wall, I get stuck in the wall.
I want the player to die when he gets crushed like this.
How can I check for this situation?
 
J

JopRillos2001

Guest
Its supposed to be like in mario, when u get crushed
 
W

Walky

Guest
You can simply use place_meeting() to check if the player is colliding with a wall, and act accordingly.
 
check for a collision with the moving platform object:

Code:
var inst = instance_position(x, y, move_platform) // ?? or whatever you call the object

if inst != noone // is in contact with moving platform
{
if y >  inst.bbox_bottom // is lower than bottom of moving platform
{
if place_meeting (x, y, obj_ground)
// ?? or whatever you call the floor object. is also touching the ground (so takes this into account, rather than, say, jumping up and touching the bottom of platform - with space below to be moved back 
//down after vertical collision)
{
gets crushed
}
}
}
 
Top