How do I squash and stretch sprite correctly?

0 favourites
  • 3 posts
From the Asset Store
Minimal Sprite Font with Stroke for Pixel Art games.
  • Hi,

    Currently I'm trying to make player sprite to squash a bit on landed. I'm doing it with sine behaviours. There are total of 2 sines, WidthSine and HeightSine. "on landed" -event will activate both sines.

    The problem: when player is not moving and lands on ground, sprite goes from mirrored to not mirrored when sine behaviour is activated. When player sprite is not mirrored everything works fine. Also, this problem only occurs when player is not moving.

    I checked values in debug-mode and I found out that when sprite is mirrored it's width is negative value and when it's not mirrored same value is positive. Then, when sine behaviour is activated it will set sprite's width value to positive. Other words, that will set sprite not mirrored.

    Is this a bug in sine behaviour? Kyatric, , Ashley

    If not, how I prevent sprite/sine from mirroring unintended way?

    Here is an example: h*t*t*p*s://www.dropbox.com/s/5cn6hl1fiwc29rj/squash%20and%20stretch%20demo.capx?dl=0

    -M-

    EDIT:

    I found out what is the problem. Apparently the problem is vectorX check. How I fixed it: I Made a global variable "Facing_Direction" and when VectorX is less than 0 -> set Facing_Direction to "left". If it's greater than 0 - > "right". Then I added events: Facing_Direction is "left" -> set sprite mirrored and vice versa.

    Now, on landed will trigger both sine behaviours and they work like intended

    Last thing I needed to add was to set correct size of the sprite object. I made that with function.

    If anyone is interested to see the result, here it is: h*t*t*p*s://www.dropbox.com/s/hliduujttc7j9jn/squash%20and%20stretch%20demo2.capx?dl=0

    -M-

  • I fail to see a logical reason why this would happen with your events.

    So likely it could be a bug with the sine behavior "unmirroring" sprites by default when modifying their width.

    Consider posting a bug report following the bug report guidelines.

    You can add this repro capx to your report as well if you want.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thank you Kyatric for you quick reply. I will post a bug report right away I also found a workaround how to fix that sine behaviour. Check my first post for details.

    -M-

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