How do I do fall damage.

Get help using Construct 2

Post » Wed Jul 30, 2014 2:37 pm

Hello , i would like to ask how could i do a fall damage. I have no idea how to scipt the falling script. What i need is if you fall from 5 metres it will take some damage , and if you fall from 10 metres you dead. I could not find any tutorial for it. Thank you for help.
B
11
S
3
G
1
Posts: 419
Reputation: 1,782

Post » Wed Jul 30, 2014 2:56 pm

There's many ways you could do this, you could measure the amount of time the character has been falling for, or their velocity, or their speed - funnily enough they're all "different".

The most universally applicable solution is a fall timer, but it would help if we knew a bit about the game, are you using the platform, physics or custom movement behaviour?
B
64
S
24
G
10
Posts: 652
Reputation: 10,738

Post » Wed Jul 30, 2014 3:04 pm

hi and thank you. I am using platform for my character.
B
11
S
3
G
1
Posts: 419
Reputation: 1,782

Post » Wed Jul 30, 2014 3:12 pm

B
64
S
24
G
10
Posts: 652
Reputation: 10,738

Post » Wed Jul 30, 2014 3:33 pm

Thank you very much , very helpful
B
11
S
3
G
1
Posts: 419
Reputation: 1,782

Post » Thu Jul 31, 2014 12:12 am

interested in seeing how this was executed. I understand that VectorY can tell me the fall speed but how can I use that to determine if/when to trigger damage?
B
12
S
3
G
1
Posts: 35
Reputation: 838

Post » Thu Jul 31, 2014 2:18 am

I would just make a counter, and every tick would add 1, and make a condition that if counter greater then a certain number, when player is on the floor, trigger once the damage stuff and reset counter.
My professional Royalty Free Music at Scirra Assets Store
--------------------------------
Specs: i5 2500, 16gb of ram, gtx 770, win 7, Focusrite Scarlett 8i6, Mackie mr8mk2, Alesis 320, browsing the net on chrome.
B
93
S
30
G
22
Posts: 1,987
Reputation: 20,203

Post » Fri Aug 01, 2014 11:06 pm

megatronx wrote:I would just make a counter, and every tick would add 1, and make a condition that if counter greater then a certain number, when player is on the floor, trigger once the damage stuff and reset counter.


Thanks megatronx.

I went with your idea and it seems to be working well. For anyone who may look at this thread, here are the steps I used:

falldamageexample.png


When falling from a large distance, the player will flash and loose 1 health.
You do not have the required permissions to view the files attached to this post.
B
12
S
3
G
1
Posts: 35
Reputation: 838


Return to How do I....?

Who is online

Users browsing this forum: matriax, plinkie and 6 guests