platf- get killed if you fall from too high?

Get help using Construct 2

Post » Tue Nov 15, 2011 4:30 am

Hi everyone!

Anybody knows how to kill, end, etc. in a platformer if you fall from a long distance? thanks in advance :)
B
2
G
1
Posts: 1
Reputation: 452

Post » Tue Nov 15, 2011 7:05 am

This is how I managed to make it work using 2 variables:

First one will control the initial Y position of the player from the fall and the other one will tell when the player is falling.


http://dl.dropbox.com/u/23138239/die%20from%20too%20high.capx
B
19
S
3
G
3
Posts: 56
Reputation: 2,496

Post » Tue Nov 15, 2011 7:06 am

The best way that I see to do this is:
1. have an invisible detector sprite extending out a bit from the bottom of the player sprite, always set to the player's position. This will be useful for many things.

If player.platform.VectorY > (say 1000)
detector: on collision with ground

then kill player.

EDIT: tuiii, you beat me to it... however my version uses no variables.sqiddster2011-11-15 07:07:42
B
90
S
30
G
24
Posts: 3,189
Reputation: 32,390

Post » Tue Nov 15, 2011 7:12 am

I first created like sqiddster suggested but VectorY is limited to the Max fall speed so if you want to make it die when falling from very high distances only, you would have to raise the max fall speed a lot and maybe you wouldn't want it to fall that fast.

But if that's not a problem you could use VectorY and save space for more events if needed :}
B
19
S
3
G
3
Posts: 56
Reputation: 2,496

Post » Tue Nov 15, 2011 8:21 am

Well, since you never go faster than the max fall speed...
it is unrealistic if you die by height, and not speed.
You might as well raise the max fall speed.
B
90
S
30
G
24
Posts: 3,189
Reputation: 32,390

Post » Tue Nov 15, 2011 12:33 pm

+Player is falling
-Add 60*dt to instance variable 'fall length'

+Player is on ground
   +'fall length' > some good distance
   -Kill player

   +'fall length' < some good distance
   -set 'fall length' to 0

Should work just fine if there are no abilities that allow the player to float or something. Might also want to set 'fall length' back to 0 if there's a wall kick or something.
Image
B
225
S
27
G
13
Posts: 1,774
Reputation: 18,024

Post » Tue Apr 17, 2012 11:32 pm

BUMP

I can't get none of these working, they always keep calculating from initial position. I need my position to update upon landing under max fall height.
B
27
S
11
G
1
Posts: 246
Reputation: 5,048

Post » Sat Apr 28, 2012 8:10 pm

Its actually simpler than that (Sorry for my english)

If its platform here is an example, its a single variable what controls everything and in a platform it detects if its in the ground or falling so its just a matter of comparing the number that gives you while falling and if its high enough well just insert your animations etc, if not it will compare while its on the ground if its still alive and reset the variable which controls the fall.

http://dl.dropbox.com/u/69032522/fall.capx

Tell me if it was usefull and if this was what you were looking for, (I use construct 2 on a Mac so if you can't open it, i'll post a screenshot of the event sheet)

andrefabud2012-04-28 20:19:41
B
7
Posts: 5
Reputation: 423

Post » Tue May 27, 2014 10:32 am

andrefabud your CAPX works very well my friend and Tuiii your link has error 404
B
205
S
27
G
13
Posts: 1,834
Reputation: 35,696

Post » Tue May 27, 2014 2:37 pm

Hi,
Add this event: Player/Platform is Falling
to the On collision of your enemy and player.
2D Game GUI Designer
B
12
S
4
G
3
Posts: 130
Reputation: 3,773

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 17 guests