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

Discussion and feedback on Construct 2

Post » Tue Jun 07, 2016 6:13 pm

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!
B
26
S
7
G
1
Posts: 74
Reputation: 2,092

Post » Tue Jun 07, 2016 6:17 pm

Given that speed increases as you fall you could simply measure the distance of the fall.
Image ImageImage
B
171
S
50
G
179
Posts: 8,392
Reputation: 113,478

Post » Tue Jun 07, 2016 8:42 pm

Thanks for your reply @newt! But it was actually quite simple :D

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)
B
26
S
7
G
1
Posts: 74
Reputation: 2,092

Post » Wed Jun 08, 2016 4:54 pm

B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Thu Jun 09, 2016 3:06 pm

Awesome! :D

I didn't know (or think of) you could check for overlapping outisde the sprite boundaries...clever!
B
26
S
7
G
1
Posts: 74
Reputation: 2,092


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 9 guests