Fall damage

0 favourites
  • 5 posts
From the Asset Store
This sound pack features 117 game sounds : Axe,Punch Swing & Hit & Damage. This is a perfect collection for your game.
  • I've been wondering... How to make my player die when he falls from a height greater than (for example) 500 pixels?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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

  • Here's a capx.

  • Thank you both!

    I love you guys! (well, in the bro way)

    This really helped me out :)

  • mmm nice one sqiddster...very simple...neater than my MO ..basing on a closer to virtural Terminal Velocity is a clever idea...LIKE BUTTON!

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