Can't make this work consistently (Detect "hard falling")

0 favourites
  • 5 posts
From the Asset Store
_______ Huge collection of metal fixtures ________
  • I want to trigger an special "landing" animation on a platform character only when he lands with a certain fall speed.

    So I gave the character a "Hardfalling" boolean variable wich is set to true or false depending on the falling speed in order to trigger the animation with the On landed platform condition.

    The thing is, this doesnt work consistently, sometimes it triggers, some times it doesnt...

    I tried the speed check both with compare speed and checking vector Y to no avail.

    I guess the problem is that the same moment it lands the speed is cut. It doesnt matter if I set the HardFalling boolean before or after the On landed condition, although theoretically makes sense that setting the boolean after the on landed event would fix this.

    I made this barebones example: in it, the HardFalling boolean is set if the vector Y is > 0 so every landing would be considered a hard fall, and set the hard fall to trigger a sound instead an animation.

    If you change the vector Y check for compare speed the inconsistent behaviour is pretty much the same, although logically, it triggers if you are moving horizontally. The order of the boolean setting/On landed check in the event sheet doesnt change much either.

    It seems to trigger much more often if you jump in place and much less when jumping from platform to platform for some reason.

    Demo

    CAPX

    Ideas? Any workaround? Thanks!

  • Given that speed increases as you fall you could simply measure the distance of the fall.

  • Thanks for your reply newt! But it was actually quite simple

    I was checking the speed limit and setting on the boolean if it was exceeded, AND setting the boolean off if the speed wasn't enough. I took out that Else and moved the toggling off to the on landed event.

    Now I have to check special cases where vector Y gets altered or reset to also toggle it off, but it works fine! (Cases like double jumping, damage knockback, and stuff like that)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Awesome!

    I didn't know (or think of) you could check for overlapping outisde the sprite boundaries...clever!

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