Flip sprite based on 8-direction direction

0 favourites
  • 7 posts
From the Asset Store
Goodbye to sprite fonts, when you have something new on the anvil for your upcoming Games !
  • I have a sprite that should either be pointing left or right. The sprite has an 8-direction behavior, but the sprite shouldn't point any direction... only left or right. I would expect to create a new event based on the 8-direction's angle, but I don't see that as an option.

  • Does your sprite have 2 frames in the animation? One facing left and one facing right?

    On key pressing left, use frame 1

    On key pressing right, use frame 0

    Something like that? Or did I misunderstand your question?

  • If I understood you correctly ...

    Create two animations, Left and Right, with the sprite pointing the appropriate way in each animation.

    In your sprite's 8Direction behavior, set "Set angle" to be "No".

    Add a keyboard object, and do:

    Keyboard -> On Left Arrow Pressed, set animation to "Left"

    Keyboard -> On Right Arrow Pressed, set animation to "Right"

    Matt

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Well, instead of using animation frame 1 or 2 I think I can just set mirrored and UNset mirrored, but I see you're both saying that I need to trigger off of the user input. I was hoping to get the event from the actual sprite's direction though because I plan to implement touch and mouse and then I'll just be repeating those event conditions or create big or... or... or... statements. But that will do it. Thanks.

  • <img src="https://dl.dropbox.com/u/8367729/construct/pics/spriteMirrored.png" border="0" />

  • I like that answer That way it doesn't matter how you change the sprites direction (keyboard, mouse, touch, accelerometer, etc).

  • That worked a beaut! Thanks,

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