Windows Problem with jump

A

Another62

Guest
Hello people,

I have a problem


As you can see on the animated image, as soon as I approach the blocks, and I jump, it jumps unlimited, while I want it to jump once, the game is full physic, how can I make ?

Thank you

Sorry for my english i'm french
 

Pretorg

Member
Not really familiar with the physics engine but it looks like once you get to close to the wall it might be triggering a collision and using it as it is in the ground to execute the jump code again, I might be wrong so it would be better if you post your jump and collision code
 
A

Another62

Guest
GML:
if(place_meeting(x, y, O_blocNoir) and canJump == false)
{
    canJump = true;
}

// Colision planche
if((Up or Z) and (canJump == true))
{
        canJump = false;
        physics_apply_impulse(O_Joueur.x,O_Joueur.y,0,-7);
}
 

Zekkan

Member
You only want to check for collisons below the player.

maybe something like this would work better
Code:
if(instance_position(x, y - 4, O_blocNoir) != noone and canJump == false)
{
    canJump = true;
}
 

Nidoking

Member
The problem is that you're checking for canjump before the player checks for horizontal collision and is pushed back out of the block. You should probably check canjump before applying horizontal speed.
 
A

Another62

Guest
Zekkan Not working, The player can no longer jump, I tried with the -1 or +1 it does not work either
Nidoking Yes , i change
 
Top