0 Favourites

Sprite animation: not working as I want.

This forum is currently in read-only mode.
  • Right, I've got a test sprite set for platform style movement with a single two frame animation, facing in two angles, 0 and 180. However, when I run the test, the animation isn't turning around. I suspect I've omitted something very simple, but I'm not sure what.

    Interestingly enough, auto mirror doesn't flip it around either. This does lend some suspicion this might be a bug of some kind. This is, by the way, originally a Construct 0.98.3 file upgraded to .5, if that helps at all.

    Suggestions?

  • This is weird. Starting from scratch. Recreated the test sprite with the same two frame animation. Auto flip doesn't work, defining angles for 0 and 180 doesn't work either. Any ideas as to what's up?

  • When running the original test through the debugger, the angle it says the sprite is when moving to the left is 0 - it isn't using the 180 degree rotation for the sprite.

    Help?

  • I think this has always been the case, but I could be wrong. You need to set the angles yourself, determining it based on the X velocity of the object. For example:

    +If Guy[Platform].VectorX is greater than 0, Set Guy.Angle to 0
     |
    +Else, Set Guy.Angle to 180[/code:lzkpz6p5]
  • Easy solution to this: program it yourself. :) Something like:

    if Key "Left Arrow" is down AND Key "Right Arrow" is not down
         Sprite: set Angle to 180
    if Key "Right Arrow" is down AND Key "Left Arrow" is not down
         Sprite: set Angle to 0[/code:2k6721ww]
    
    Not that hard to add that in :o
    
    EDIT: But going based on velocity like Linkman's example is probably a better way to do it actually because it would take friction into account of which way you were facing. :P (You posted while I was posting! D:)
  • Ah.

    I was remembering the answers I got in this thread, and thought (perhaps naively) that that would apply across different behaviour types.

    +If Guy[Platform].VectorX is greater than 0, Set Guy.Angle to 0
    |
    +Else, Set Guy.Angle to 180[/code:1tdsp9ft]
    

    Pardon the excessive noobiness here, but erm... which condition(s) would allow me to do that? I'm probably staring it in the face but have no idea which one it might be...

  • And now to answer my own question!

    If I do:

    pick by sprIvoRobotnik [Platform].VectorX>0
     sprIvoRobotnik: set angle to 180
     else
      sprIvoRobotnik: set angle to 0[/code:28gf87w5]
    Movement works as expected using this.
    
    That said, I'm clearly (not) doing something else I should be, because once movement ends the sprite returns to the default angle. Ideas?
  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • You want to use the standard "Compare" event in the system object.

  • Using the system compare condition...

    Now, I have:

    sprIvoRobotnik [Platform].VectorX Greater than 0
     sprIvoRobotnik: Set angle to 0
     else
      sprIvoRobotnik: Set angle to 180[/code:syg8w1sk]
    but it is still showing the reversion behaviour.
    
    Any clues?
  • Okay, that one's partially my fault. The Else condition isn't proper here, as it will be setting the angle to the left if you're not moving. You want to do this, instead:

    EVENT ONE:

    sprIvoRobotnik [Platform].VectorX GREATER than 0

    sprIvoRobotnik: Set angle to 0

    EVENT TWO

    sprIvoRobotnik [Platform].VectorX LESS than 0

    sprIvoRobotnik: Set angle to 180

    That should fix it. Also, with the Else condition, it's supposed to be placed directly under the event it effects, not as a subevent. Sorry for all of the confusion here.

  • Should've occurred to me anyway, really. Still, thanks for the help!

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