Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In Register

Is it possible to speed up a player while holding a key?

I'm making a Top-Down game and I want to be able to speed up the player and the player's animation while holding shift. Is that possible?


  • edited November 2017
    Sure. There's a few ways to do it, this is the easiest way for a 2D platformer.

    Let's say your speed is 5 and -5,
    Make 4 new numbers,
    Have 7, 5, -7, and -5
    Connect the positives to set the positive and negatives to set the negative.

    Have Shift repeat and have down go in to the two 7s and up into the two 5s.

    When you hold shift, your speed sets to 7 and -7, when you stop, it sets back to 5 and -5.

    Make 3 filters,
    Greater than 0 (pass) greater than 5
    (fail) less than -5

    Greater than 5 and less and -5 pass to play run animation

    Greater than 5 and less than -5 fail to play walk animation

    That's how it works for flipped 2D. If you're doing an RPG, you have up and down animations as well. I haven't made an RPG so naturally I'd do a complicated math system for animations. Maybe there's a better way to do it.

    Unless you post a link to your game, I have no idea how you're doing the animations and walking so I can't really explain much more.
  • an example (: go to sonic's behaviors
Sign In or Register to comment.

| make games in your browser
@ 2017, All rights reserved.

Contact us

Get In Touch