Fall damage

Get help using Construct 2

Post » Sat Oct 27, 2012 4:49 pm

I've been wondering... How to make my player die when he falls from a height greater than (for example) 500 pixels?
B
4
Posts: 4
Reputation: 397

Post » Sat Oct 27, 2012 6:27 pm

There are a few ways but I would Make some instance Variables for your Player that are something like
"Player_Start_Y"
"Player_Final_Y"
&
"Player_Fall_Distance"

and set all defaults to 0

Next make an Event somewhere near the top of your Sheet..-> Every Tick-> Set Value"Player_Fall_Distance" to "Player_Final_Y" - "Player_Start_Y"

Next make a New Event under the one you just did above
but make the Conditions..-> Player -> Is Falling & Do once only
& the Actions something like...-> Set instance Value "Player_Start_Y" to "Player.Y" & reset "Player_Final_Y"
This makes sure that on the beginning of each fall that the Final Y is reset not that it really needs it coz its updated..but yeah doesnt hurt to make certain

and then another Event Condition that goes Player -> Is on Floor & Do once only
and the Actions for this one....-> Set "Player_Final_Y" to "Player.Y" again..

and the only thing you need then is Another Event that Checks The result of "Player_Fall_Distance" to the Distance value you want
and make an Action the Kills the player or drops their health by the amount you wish...

And one last thing....
You would need to reset all of the Variables I think...but maybe not

I havent tried this yet...let me know if it doesnt work and I'll have more of tinker...lol
Hope I didnt miss anything



When in doubt..or you are lost in a Zombie apocalypse or someone is giving you a hard time..Remember one thing..... Read the Construct 2 Manual..it will save your life.:)
B
30
S
11
G
8
Posts: 313
Reputation: 7,360

Post » Sat Oct 27, 2012 6:38 pm

Here's a capx.

sqiddster2012-10-27 18:55:59
B
90
S
30
G
24
Posts: 3,189
Reputation: 32,400

Post » Sat Oct 27, 2012 9:53 pm

Thank you both!
I love you guys! (well, in the bro way)
This really helped me out :)
B
4
Posts: 4
Reputation: 397

Post » Sun Oct 28, 2012 10:23 am

mmm nice one sqiddster...very simple...neater than my MO ..basing on a closer to virtural Terminal Velocity is a clever idea...LIKE BUTTON!
When in doubt..or you are lost in a Zombie apocalypse or someone is giving you a hard time..Remember one thing..... Read the Construct 2 Manual..it will save your life.:)
B
30
S
11
G
8
Posts: 313
Reputation: 7,360


Return to How do I....?

Who is online

Users browsing this forum: SpartCrafter and 18 guests