How do I make my sprite stay diagonal when I stop moving?

0 favourites
  • 4 posts
From the Asset Store
This is a code so you can see the same skin on all screens (peers). Each peer gets a skin, in addition to 4 directions t
  • Hi everybody!

    I have a sprite (a square) set for 8 directional movement at 45 degree intervals, but when i stop moving diagonally, the sprite just reverts to one of the 4 directional positions (up, down, left, right). Is there a way to get it to stay facing diagonally?

    Thanks!

  • barrettwolfe

    Hi everybody!

    I have a sprite (a square) set for 8 directional movement at 45 degree intervals, but when i stop moving diagonally, the sprite just reverts to one of the 4 directional positions (up, down, left, right). Is there a way to get it to stay facing diagonally?

    Thanks!

    There's no need to multi-post - you've already posted this exact question HERE.

    Please just have a little patience. Many of the helpful users are from varying time zones.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I'm afraid it depends on your way to handle inputs for the player.

    If you are just using the default controls, I don't think it can work, other than if the user uses the arrow key in diagonal and release both keys at the same time (using all the default configuration of the 8 direction behavior, the character stays in diagonal).

    Otherwise, you would need to put some kind of buffer in your input handling and when the character was going in diagonal, check for some time between the moment the keys are released, so that even if the last input was a single arrow, you would still believe the intent was to go in diagonal.

  • It was the input. Thank you

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