Platform Behaviour unreliable

0 favourites
  • 12 posts
From the Asset Store
The complete source file for my Youtube platformer game tutorial series.
  • Hello folks,

    having some issues with the Platform behaviour being unreliable for jumping.

    sometimes it takes 2 or 3 key/controller presses before it gets called.

    my variable is definitely being set/unset properly (checked in debug) but often the "Simulate Platform pressing Jump" just doesn't work, everything else will get called in the function but the character wont jump.

    This seems to be fairly random and I cant track down a pattern in it.

    Tried to counter this by manually setting the X/Y values just before the jump in case it was a collision issue but that's not helped either.

    <img src="" border="0" />

    any ideas?

  • The platform behaviour works best using a rectangular collision polygon (or at least, a collision polygon with the bottom side horizontal), does your sprite meet this requirement?

  • Yup, that was the first thing I checked.

    <img src="" border="0" />

  • The jump action only performs if the object that has the platform behavior is in collision with a solid/jumpthru object.

    It would be easier if you posted directly your capx instead of screenshots.

    You can check for the condition "is on floor", if it is true, then the jumping reacts accordingly.

    Check out this game does the jumping (up arrow) works as you would expect ?

    It's only the platform behavior with correct collision box.

  • :

    I meant on all the animations where the character could potentially jump (aka when it is on the ground)

    (Also, there are condition to check if the character is on the ground or not, maybe you could use that instead of the IsJumping variable, just a thought, maybe you need the IsJumping for something else)

    EDIT: samourai'd, I mean ninja'd by kyatric

  • Might not help but I note you have a delay of 0.1s before setting the is jumping variable to 1. Try putting the is jumping zero check as a first condition and then the keyboard / game controller checks as sub events and also change the is jumping to 1 to before the wait. Hope this makes sense - UK on my phone.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Hello guys, cheers for the replies and suggestions, appreciate it!

    Tried using the "is on floor" behaviour and still getting same result.

    Also removed the manual "isjumping" check in favour of "is on floor".

    Pasted some objects etc into a sample file to reproduce the results with a simple event tree.

    (includes character sprite with the anims to show collision is standard rectangle on all frames)

    Skydrive link to CapX:

  • This might help:

    Each animation frame has the collision set to bounding box but each frame is a different width and the origins are at different y distances from the bottom of the collision box. So, when the animation runs, each new frame puts the collision box either overlapping the ground or above the ground by a few pixels - this will be exacerbated on the slope when the effect of frames of different widths also comes into play.

    With your 'is on platform' check I don't see any 'should be jumping' notifications when the character actually doesn't jump, but I do see that some jump key presses can be missed.

    The fix - create an invisible rectangle about the average frame size of the runner and give that the platform behavior you want. Pin the runner sprite to it and voila!

  • Hi

    I second the opinion that your "Wait" action is the most likely source of problems. Be aware, that your script does not stop while "Wait" is executed - it simply skips the remaining part of sub-event, but all other remaining events do run without waiting!

    "Wait" might cause really non-intuitive behaviour with variable assignments, especially when used with local variables.

    Try removing "wait" to see if your app behaves OK without it.


  • Thanks for all the suggestions folks!

    The final solution was actually thanks to Colludium - their idea of the invisible uniform box being used as a "fake player" with the actual sprite just pinned to it has worked a treat. No more problems with jumping!

    Excellent idea mate, thankyou!

  • Another thing it looks like you're doing is moving the player down just before simulating a jump. Why would you do that? It means you're wedging the player into the floor, which will make the platform behavior think it's stuck, then simulating a jump. That would probably be why it doesn't work.

  • Beginner tutorial: how to make a platform game - You might want to study it thoroughly, it might help for other forthcoming issues.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)