How do I gaze into the past?

Get help using Construct 2

Post » Fri May 30, 2014 6:52 pm

In a platformer I'm making, I only want an impact sound to play if the player's Y-vector is greater than 100 when they hit the ground. I guess the way to do this is by working out how fast the player was moving a few ticks before they landed, so I've written, "Every thirtieth of a second, set instance-variable-1 to the Y-vector, wait a thirtieth of a second, then set instance-variable-2 to equal instance-variable-1. If instance-variable-2 is greater than 100 when the player lands, make a noise." Unfortunately this is buggy and unreliable and I'm sure there's a better way to do it.

Another example is if I wanted something to follow the player around, such as a hat that lags behind a little bit. I want to write, "Every tick, set the hat's position to what the player's position was a few ticks ago." So what do I do? How do I find out values from the past?
B
8
S
1
Posts: 54
Reputation: 824

Post » Fri May 30, 2014 8:09 pm

Here's a quick example of a thud when falling too far.

thud.capx
You do not have the required permissions to view the files attached to this post.
B
46
S
23
G
7
Posts: 459
Reputation: 6,763

Post » Fri May 30, 2014 8:29 pm

Oh, of course! Only check vector Y while the player's falling. Duh.

Thanks a bunch.
B
8
S
1
Posts: 54
Reputation: 824


Return to How do I....?

Who is online

Users browsing this forum: dop2000 and 14 guests