Using sine when mirrored

0 favourites
  • 9 posts
From the Asset Store
With this template you will learn how to use the GooglePlay Games native plugin
  • I'm trying to make a simple stretch effect for my character's attack. It's working just like I wanted when the character isn't mirrored, but when they're mirrored they "de-mirror" itself before playing the sine. Changing the sine magnitude from 25 to -25 while the character is mirrored doesn't work either.

    What do? I'm out of ideas.

  • I do this sort of thing in two sub-events:

    Upon pressing F

    • Is mirrored
    • - equation
    • Is not mirrored
    • - reverse equation
  • Tried it already, doesn't work. Even if I change the magnitude to reverse it still swaps the character to non-mirrored state. The sine just moves backwards that way.

  • bump for justice

  • Just tried to see for myself. It's most definitely a bug, the "mirrored" flag has no effect while a Sine set to "Width" is active. I believe the same would hold true for a Sine set to Height and the "flipped" flag.

  • Yep. I'm trying to use the "Width" setting. I guess I just gotta make mirrored animations for the attacks until the bug is fixed.

  • After a few more tests, it seems that changing the width of an object glitch its mirrored flag, and changing the height glitch the flipped one. "Is mirrored" and "Is flipped" still register has "true" but they don't appear mirrored/flipped. Definitely not a wanted behavior... In the meantime, here's a capx with a workaround.

    https://dl.dropboxusercontent.com/u/700 ... round.capx

  • Thanks a lot, man! Great job! I'll be posting a bug report soon about this.

    EDIT: Could you explain what that "Self.isMirrored ? -1 : 1" part means?

    EDIT2: This seems to only work on static objects. My object has an attack animation, so I have to constantly change the "OriginaWidth" and that seems to mess the calculation up pretty badly causing flickering. A static number does work and kinda does what I want and should be good enough for now.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • For your first question, it's an "inline if" or conditional expression, it goes like this "logical expression ? true expression : false expression". In this case, I multiply the width by -1 if mirrored, or by 1 if not.

    Yep, indeed, it only works with static object because I used a static number in the formula. Give it another go, I changed the formula a bit so it now uses a percentage of the original animation frame width.

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