How do I change or set sprite direction with sine behaviour?

0 favourites
  • 3 posts
From the Asset Store
Simplistic hyper-casual game with nature elements. Tap to switch between the 4 elements and reach a better score.
  • Hi there,

    Maybe someone can help me with this ...

    I want to animate some enemies walk around with a simple horizontal sine movement, nothing special so far.

    But I also want to mirror the enemies according to the direction they move. If I try it with only one enemy on stage, there is no problem. The issue comes in place, when there are multiple instances with different sine settings.

    You get a better understanding if you look into the attached example.

    https://drive.google.com/file/d/11ly7GeLksnZO0GfqTH3MPvQoP0KI8KBK/view

    The left enemy works fine. If you enable the right enemy, he will act weird.

    I tried also some code variations with "for all" & "pick all" but no luck ...

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Put event 3 and 4 in subevents under a For each condition. Also since period is a measure in seconds it doesn't make sense to have it be a negative number... although it seems to work I would change it back to a positive number and use the following

    + System: For each Grump

    ----+ System: Grump.Sine.CyclePosition > 0.25

    -----> Grump: Set Mirrored

    ----+ System: Grump.Sine.CyclePosition > 0.75

    -----> Grump: Set Not mirrored

  • Hi oosyrag,

    thanks for the hint. I see now, the issue comes from the initial period settings on each enemy sprite. I had one set to a positive start value and the other to a negative.

    If all start values are positive, your example works as expected.

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