How do I mirrored an object with Sin behaviour

0 favourites
  • 4 posts
From the Asset Store
Welcome! I-Spy (Hidden objects) is an educational puzzle that is more than just seek-and-find activities.
  • Hi guys,

    I got a character which its face is always looking to the right side. I need this character to move left and right at a fixed position, so I set the Sin behavior for it and set its movement to horizontal.

    When the character moves from the left side to the right side, it is fine because it always faces to the right side. However, if it moves back from the right side to the left side, its face still looking to the right side which looks weird. Is there any way I can use the mirrored attribute in this case.

    Thanks in advance.

  • Attached is a capx example for you.

    All I did was add an event for when the Sprite reached the end of the sine magnitude - 1 which mirrored the Sprite object.

    I hope that gets you what you need and good luck with your project.

  • As a bonus, I decided to include another capx that shows another way to do the same thing. This method only uses 1 event for changing between the 2 directions but, it is much more difficult to read. It uses 2 animations for showing the different directions instead of mirroring the Sprite. Then uses a ternary operation (look it up on Google if you don't know what that is) to decide which animation to show.

    This is a more advanced method that can cut down your event count, but can be a nightmare to upkeep if you ever have to go back and fix it. That is unless you have a good grasp on what a ternary operator is and how it works.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Awesome, thanks. I will apply and see how it works. Will let you know soon.

    Cheers,

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