Modifying sprite's width with Sine behaviour

Bugs will be moved here once resolved.

Post » Thu Jun 09, 2016 1:46 pm

Problem Description
When sine behaviour is used to set the width of sprite object, it will always return to positive value after "on landed" -event.

Attach a Capx
This example is mine:
h*t*t*p*s://www.dropbox.com/s/8fxwib0eri1a8pr/squash%20and%20stretch%20demo%20r227.capx?dl=0

This is example from @Kyatric :
h*t*t*p*s://www.dropbox.com/s/f2uxrxf8hbti361/sine_width_unmirror_r229.capx?dl=0

Description of Capx
I want to squash and stretch player sprite after "on landed" -event. I'm doing it with 2 sine behaviours, WidthSine and HeightSine. "on landed" -event will activate both sines.

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

Steps to Reproduce Bug
  • press left (player will turn left (is mirrored))
  • jump
  • wait player to land

Observed Result
sprite go from mirrored to not mirrored.

Expected Result
sprite stay mirrored.

Affected Browsers
  • Chrome: (YES)
  • FireFox: (YES)
  • Internet Explorer: (YES)
  • NW.JS: (YES)

Operating System and Service Pack
Windows 7 Professional SP1 32-bit running through vmware Fusion 5.0.5 (1945692) on Mac OS X 10.9.5.

Construct 2 Version ID
r227 32-bit
B
16
S
2
Posts: 60
Reputation: 984

Post » Thu Jun 09, 2016 2:37 pm

What is the positive value? At the size or somewhere else ?
Sorry I kindaa confuse what yur question is
+ Bigger - Smaller
B
13
S
5
G
4
Posts: 119
Reputation: 3,353

Post » Thu Jun 09, 2016 2:52 pm

fathijack1999 wrote:What is the positive value? At the size or somewhere else ?
Sorry I kindaa confuse what yur question is
+ Bigger - Smaller


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 regardless of mirroring / not mirroring. Other words, sine will set sprite to not mirrored even though it's mirrored.

Here is my original post:
h*t*t*p*s://www.scirra.com/forum/viewtopic.php?f=147&t=177622

-M-
B
16
S
2
Posts: 60
Reputation: 984

Post » Thu Jun 09, 2016 3:07 pm

Oh.. Put at event sheet
When sprite is mirror ( invert this ) > Then the width you want
Sprite l Is mirror X - Sprite l Set width + ..
B
13
S
5
G
4
Posts: 119
Reputation: 3,353

Post » Mon Jun 20, 2016 4:16 pm

I can't reproduce any issue with the first .capx. It looks like it always works fine here.

With the second (Kyatric's) .capx, it's just that mirror is a shortcut for negate width, and the sine behavior remembers the original size to oscillate from, which was a positive width. If you use "update initial state" before activating it, it then oscillates based on the negative width. However since it increases the width starting from a negative size, it ends up making it narrower instead of wider! You probably want to invert the magnitude as well there.

This is all by design, closing as not a bug.
Scirra Founder
B
395
S
232
G
88
Posts: 24,371
Reputation: 193,762


Return to Closed bugs

Who is online

Users browsing this forum: No registered users and 2 guests