How do I Prevent "Falling" Unless after a Jump?

0 favourites
  • 14 posts
From the Asset Store
Jump on alphabets in the proper order and reach the sun!
  • My problem is pretty straight forward. Because planets are round, player is always 'falling' for short millisecond bursts when i run really rapidly around the surface of the planet. basically whenever the player hits a 'peak' of the collision box since it's not a perfect smooth circle, he can technically 'fall' off the edge of the earth for just one split second.

    The problem with this is that if i happen to push the jump button just as that platform 'falling' animation state is triggered, the guy wont jump.. so in the hear of battle, there's basically a 5% ish chance that your jump wont register...

    Is there some way to 'disable' the falling state unless i specifically say to use it.. i realize that's a roundabout way to solve the problem, but short of programming my own platform controls entirely, which id much rather not do, i dont know how else to really work around it...

    Does anyone have any thoughts or advice? Is what i mentioned making any sense even?

  • maybe you could set the platform gravity really high EXCEPT for when you're jumping, so he falls so fast this can't happen?

    lowering the collisions peaks a possibility?

    it's not so much you want to disable falling, it's not directly the falling stopping you from jumping, it's just that your feet aren't on the ground. I don't know if that helps. I'll think on it some more...

  • Yeah i tried setting gravity to 5000 when on the ground, it seemed to help a lil bit and then triggered gravity to flip to 1000 on jump. Ive also been trying to reduce the collision peaks, but we're talking circles and im already dealing with 32 collision points just to keep it relatively smooth.

    Thank you tho great ideas, still getting little blips tho.. Gonna try jacking the gravity up to like 10k now hahah

  • Yeah 30k gravity all but eliminates it on the small planets where the resolution of the collision shape is more 'round'... On the bigger planets when the points are more spaced out and actual 'peaks' happen, i still get the odd 'fall' every once in a while. It's way better than it was now, and only the big planets are an issue now... What i would give for round collision shapes like unity, tho. damn.

  • 30k, huh? sheesh! If it were me, I'd probably just go ahead and make my own platform jump function..

    Good luck!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Dont do a collision check, do an overlap check.

  • Dont do a collision check, do an overlap check.

    Can you explain Tylermon? It's the collision checks built into the platform behaviour. it's more along the lines of the animation types than the collision types... ie "Falling" "Moving" "Jumping" and "Standing" if you know what i mean..?

    Thanks guys. Will probably just write my own jump.

  • > Dont do a collision check, do an overlap check.

    >

    Can you explain Tylermon? It's the collision checks built into the platform behaviour. it's more along the lines of the animation types than the collision types... ie "Falling" "Moving" "Jumping" and "Standing" if you know what i mean..?

    Thanks guys. Will probably just write my own jump.

    You would have to apply a speed/force of your own. Don't use the default jump behavior. But using an overlap check, should be better than a collision check for a circle, because it will more accurately represent the shape.

    not checking of course, if the player can walk on it. Use a collision for that. But check if they can jump using the overlap.

    hopefully that makes sense? I can try saying it differently maybe, my brain is a bit tired haha. Been delving into the realms of multiplayer and wrapping my head around that sort of has my focus haha.

  • Awesome, yeah I think i know what you mean: if overlapping circle shape, and jump button pressed: do jump function.

  • Yeah still having issues with this because now i want to have a different falling animation vs. standing / walking so its triggering the falling animation whenever he's hitting those spots, even just for a sec. So even if i re-write the jump it's going to be an issue with the falling animation... i wish i could think of some other way to basically 'not trigger' falling, unless a jump has been detected...

    Ashley - is there any way to force a platform animation?

    thx guys

  • As the platform tutorial says you shouldn't have the behavior on an animated object, make sure you are using a non-animated box with the platform movement otherwise animations will intefere with the collision detection of the platform behavior.

    If you don't want small falls to block jumps, just allow a jump as long as you've been touching the ground within the past, say, 50ms. You will probably have to set the vector Y manually since the behavior won't let you jump if you're in mid-air.

    I don't know why you're asking about forcing a platform animation since the behavior doesn't actually set animations, it just fires triggers as guides which you can ignore if you like and replace with other events if it suits you better.

  • Ashley

    My bad i guess i dont mean the animations themselves, but the platform state which triggers the animation. Definitely using a green square as my player controller. Sorry for the weird way to ask about it. I think the millisecond delay might work since its always just little 'ticks' that block the jump.. trying to wrap my head around the actions, but i think i'll get there. Thanks for your help!

    Nate

  • This did the trick Ashley, thank you. I removed the 'requirement' for the player to be 'on-floor' when triggering a jump. Instead I created a "jumpAble" instance variable, which is set to 1 when touching ground. If you leave the ground it subtracts at 0.04 per tick (found it to be the best balance) So basically in less than a second its set to zero. Then i just said:

    • If you push jump
    • and jumpAble > 0

    - Set jumpAble = 0

    - Move player at velocity -X (jump height)

    Thanks again. Game getting smoother and smoother

  • Awesome! Glad to see this solved. Great solution!

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