Jitter on Collision with 8Direction Behaviour

0 favourites
  • 4 posts
  • Hi,

    I'v just gotten into programming with Construct 2 and I am already busy with a fun little project, however there's one bug I can't seem to get rid of:

    The main sprite has a 8direction behaviour with some custom animation events that I made. The animations work as they should. I've also added some custom collisionboxes on the map in the form of rectangles with a Solid behaviour.

    When the Hero collides with a collisionbox, the 8direction behaviour tries to go in another direction, but because a key is still pressed down it switches back and forth between 2 directions, hence the jitter.

    I've already looked up similar situations, but those are from 2 years ago... How can I solve this?

    /s/1dg6ci3ef6guqxk/PK-1.0.0.capx?dl=0 (add dropbox.com in front of it)

    (The textbox is to show the angle of the 8Direction behaviour)

  • The jitter comes from the fact that when going to the left, your sprite is alternating between going left and going up, so it's passing from the "side" mirrored animation to the "up" animation non-stop.

    To prevent that, you don't want to use the 8 direction behaviors and handle the movement in events yourself, so that when your sprite goes into a wall, it just goes back to its previous position and do not move further.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • This thread should have your answer, I think. Much of the problem is actually the solid behavior in this case. Using that method has made everything great for my game with the 8 direction behavior.

  • Hi,

    [quote:18m3qru3]To prevent that, you don't want to use the 8 direction behaviors and handle the movement in events yourself, so that when your sprite goes into a wall, it just goes back to its previous position and do not move further.

    Everything started working when I processed the movements manually! Thank you for the help!:)

    [quote:18m3qru3]This thread should have your answer, I think. Much of the problem is actually the solid behavior in this case. Using that method has made everything great for my game with the 8 direction behavior.

    I didn't want the ability to slide on the walls or something similar to what is shown in the thread. The animation had to come to a stop on collision with a wall. That problem is luckily solved now thanks to Kyatric

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