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-