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

GML [Solved] Fail in collision :(

L

Loïc Mouton

Guest
Hi GMC !

I'm new in the Game maker Community and i've a problem with the collision of my player.

On the platform, he has collision but he can pass trough wall :/

upload_2019-11-10_17-12-47.png

Here it's normal ...

upload_2019-11-10_17-13-32.png

But here it's not normal at all.

I thinks the problem is from my code for vertical colission so there is it :

Code:
if (place_meeting(x, y + vspd, obj_Wall))
{
    while (!place_meeting(x, y + sign(vspd), obj_Wall))
    {
        y = y + sign(vspd);
    }
    vspd = 0;
}

y = y + vspd;
Thanks for your help !!!
 

Yal

🐧 *penguin noises*
GMC Elder
The code you posted only checks BELOW you, do you have any collision checking to the left / right as well?
 
L

Loïc Mouton

Guest
Oh you're right, there is my code for horizontal collision :
Code:
if (place_meeting(x + hspd, y, obj_Wall))
{
    while (!place_meeting(x + sign(hspd), y, obj_Wall))
    {
        x = x + sign(hspd);
    }
    hspd = 0;
}
 
L

Loïc Mouton

Guest
I don't understand :(

I've tried the exactely same code on an other little game and it works ! I don't understand why he doesn't work on this game :(

Please somebody help me
 
Top