How do I use different animation when bullet angle changes

0 favourites
  • 3 posts
From the Asset Store
3D Car Pack 1
$2.99 USD
3D models + Rendered Low-Poly Cars in isometric, top-down, and side angles.
  • 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...

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

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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"

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