How do I gaze into the past?

0 favourites
  • 3 posts
  • 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?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Here's a quick example of a thud when falling too far.

    [attachment=0:1wfmjza8][/attachment:1wfmjza8]

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

    Thanks a bunch.

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