Avoid the 8dir behavior correct position auto at stop?

Get help using Construct 2

Post » Sun Aug 03, 2014 11:36 am

I mean, when you have a sprite moving on any direction, if you take a diagonal movement and then stops, the 8 direction behavoir corrects automatically the position, setting it to one of the default facing left, right, up or down positions. Here is a capx for best explaining.

How to avoid it? Any suggestion?
You do not have the required permissions to view the files attached to this post.
B
27
S
5
G
1
Posts: 58
Reputation: 1,684

Post » Mon Aug 04, 2014 10:31 pm

I tried it with the keyboard and it looks like the problem is that when you're releasing the keys the last one released is counted as a movement, that's why the sprite turns to that angle, you can fix that by adding an event
if key is not down up
and key is not down down
and key is not down right
and key is not down left
sprite stop 8 direction
Image
B
80
S
30
G
12
Posts: 517
Reputation: 12,713

Post » Tue Aug 05, 2014 2:44 pm

Thanks Lof, it's a good trick. Bad side is that you lose deceleration properties. :(
B
27
S
5
G
1
Posts: 58
Reputation: 1,684

Post » Tue Aug 05, 2014 2:52 pm

so here is another little trick for you:
event 1
if up+down+left+right is not down
trigger once
set golval var sAngle to sprite.angle

event 2
if up+down+left+right is not down
sprite set angle to sAngle
Image
B
80
S
30
G
12
Posts: 517
Reputation: 12,713


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 22 guests