How do I use different animation when bullet angle changes

Get help using Construct 2

Post » Sat Nov 07, 2015 8:14 am

I have a sprite that has 3 animations: Default, Left and Right.
Left is a unicorn running toward left. Right animation is similar.

I am stuck on what condition i need to use to detect when the object hit solid and bounce back and therefore change direction.
I only care about X direction (left, right).

I disabled Bullet's 'set angle' because the object can move in any direction but i only have left or right animation.

Things i have tried:
1. Check the object's angle between -90 and 90 to detect facing right and else for left.. It always think it is facing right...
2. remember the object's last X. Basically i have 2 'on every tick' event, and on the first one, compare the last X to current X and if the last X is less than current X, i assume it is facing right. in the 2nd 'every tick' event (it is right below the first 'on every tick'), i update the instance's last X variable. Doesn't work for some reason.
3. Debugger shows that bullet behavior has vector X but i don't know how i can use it in Event sheet.

There gotta be an easier way to do this...
B
5
S
1
Posts: 32
Reputation: 439

Post » Sat Nov 07, 2015 9:07 am

Message: laypax can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
Image

Explanation: http://i.imgur.com/kP8jOjB.gifv
B
14
S
2
Posts: 36
Reputation: 791

Post » Sat Nov 07, 2015 11:23 am

laypax wrote:Image

Explanation: http://i.imgur.com/kP8jOjB.gifv


This would work if the set angle propertie of the bullet behaviour wasn't set off..

You could try this:

system is between angles : Sprite.bullet.angleofmotion is between sprite.angle-90 and sprite.angle+90
> sprite set animation to "right"
else
> sprite set animation to "left"
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775


Return to How do I....?

Who is online

Users browsing this forum: RandomlyMooN and 9 guests