Modifying sprite's width with Sine behaviour

0 favourites
  • 5 posts
From the Asset Store
A set of 10 pixel art animated magic effects with icons. 2 Fire, 2 Earth, 2 Wind, 2 Water, Portal, Explosion.
  • 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

  • What is the positive value? At the size or somewhere else ?

    Sorry I kindaa confuse what yur question is

    + Bigger - Smaller

  • 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-

  • 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 + ..

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.

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