platform falling damage

1

Attached Files

The following files have been attached to this tutorial:

.capx

falling-damage-tutorial.capx

Download now 176.28 KB

Stats

2,192 visits, 2,748 views

Tools

License

This tutorial is licensed under CC BY 4.0. Please refer to the license text if you wish to reuse, share or remix the content contained within this tutorial.

Published on 16 Apr, 2017. Last updated 19 Feb, 2019

this is a simple tutorial for a falling damage, using distances, because with the method of counting the time when you falling, can be affected by the frame rate of the game, with this method, the fall distances calculation will not affect by the frame rate.

first we need to create 3 global variables.

1- iY or initial Y, this is the player y postion when you start to falling.

2- eY or end Y, this is the player y position when touch the floor.

3- max_distance.

I am using the platform templete of C2.

now we create 2 events.

first event.

player--Platform On fall===== set iY to player.Y

second event.

player--Platform On landed===== Set EY to player.Y

subevent--system max_distance<or=int(distance(0,IY,0,EY))=====do the damage event.

.CAPX

falling-damage-tutorial.capx

Download now 176.28 KB
  • 0 Comments

Want to leave a comment? Login or Register an account!