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?