Jitter on Collision with 8Direction Behaviour

Get help using Construct 2

Post » Thu Dec 24, 2015 10:08 am

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)
B
3
Posts: 2
Reputation: 179

Post » Thu Dec 24, 2015 10:44 am

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.
New to Construct ? Where to start

Image Image

Image Image

Please attach a capx to any help request or bug report !
Moderator
B
294
S
117
G
96
Posts: 7,311
Reputation: 71,086

Post » Thu Dec 24, 2015 2:49 pm

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.
B
103
S
38
G
19
Posts: 962
Reputation: 17,996

Post » Thu Dec 24, 2015 7:49 pm

Hi,
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!:)

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 :) Thank you anyway for your helpfulness :)
B
3
Posts: 2
Reputation: 179


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 26 guests