Maybe bug, but I might be wrong

Untitled

I have no idea why this happens but when I go back a very specific amount & jump I will get what I think is a double jump. The ray actives when it hits a certain block & makes a sound so it’s not that. If anyone has an idea of how this could be my fault please tell me. Game Link - http://flowlab.io/game/play/1033540

I think it is a big it has happened in my games too!

Hey @TheForgotten - I checked out your game and I can reproduce the issue.

I watched the behavior blocks while it happens, and can confirm it is not the raycast causing the problem.

Here’s the exact sequence of events that causes the double jump:

  1. Dog is moving on x axis
  2. Player presses “w” to jump, sending an impulse force to the Dog
  3. Dog is still moving left, and touches the next ground block before leaving the ground (adding a force does not move the object instantantly, this happens over time)
  4. Now the switch is on again, the Dog gets another jump force

I think that just turning off “repeating” on the jump key would fix this - do you have repeating enabled on purpose?

If you wish to have a repeating jump button, another fix would be to move the dog a pixel or two up when pressing jump, so that the Dog cannot touch a second ground block

Another possible fix would be to just use some raycasts to check for the ground instead of the collision/switch method. If you do this, be sure to use a few of them so you don’t get stuck on an edge.

@grazer I did think that maybe the issue so I added a delay of 4/10 of a second on the collision, so that’d mean for whatever reason the impulse is being delayed when you walk in a different direction. I will find a way to prevent this for right now but could their potentially be an update that could stop impulses from being queued and rather act immediately?

nvm I know understand xD.

Hey @TheForgotten - impulses are not queued, they are already applied immediately. The issue is that an object accelerates over time:

Acceleration = Force/Mass

This means that (depending on the force and mass) the object may not move enough in a single frame to clear it completely from contacting another object. You could add more force (or decrease the mass) enough to resolve the issue probably, but that would mess up the feel of your jumping. Moving the sprite up a pixel or two when you press jump will ensure that no more ground collisions happen, and also make the jumping feel a little bit snappier IMO.

@grazer I could do that but I have thought of an easier way this could be done but it’d involve adding a feature that i’ve wanted for a long time. A input for the collision called “check” which will make it recheck if its touching the given block.

f

btw @seamothmaster45 here is a fix just prevent collisions for a good bit after the jump.

oh ok thanks!