2
\$\begingroup\$

I am attempting to code a run key for my platform game in Game Maker. I'm attempting to keep my momentum when I jump, but yet stop moving at a run speed as soon as I hit the ground if Shift has been let go during the jump. How do I go about coding this?

\$\endgroup\$
1
\$\begingroup\$

No code was presented.

You want to create an algorithm that handles momentum decay.

The underlying run function already causes the object to move quicker. You should store that value and create a function that when released takes that value and starts decaying it, rather than cuts you off immediately.

If you want this to occur only when you jump, you will need to handle the code for that case.

| improve this answer | |
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.