Scaling anchored sprites does not take origin into account

0 favourites
  • 6 posts
From the Asset Store
2D fighting template based in the game that defined the fighting games genre.
  • Problem Description

    Scaling a sprite does not take origin into account when using anchors.

    Attach a Capx

    See AnchorError.caps

    Description of Capx

    The CapX shows 5 sprites (yellow circles). 4 of them are anchored in each corner of the layout - and one (located just below a button) is not anchored. The button will change the scale of all sprites when clicked.

    Steps to Reproduce Bug

    • Step 1. Press the button.
    • Step 2. Look at the sprites, that scaled randomly. Observed Result The problem is that anchored sprites are NOT scale around their origin (but always at origin 0,0). Expected Result I expect that scaling (even for anchored sprites) will honor the sprites origin when scaled. Affected Browsers
      • Chrome: YES
      • FireFox: YES
      • Internet Explorer: YES

    Operating System and Service Pack

    Windows 7, SP1

    Construct 2 Version ID

    I'm using release 184

  • This is actually the normal comportement of the anchor (the left side or top side will be anchored to a relative border of the viewport), I agree this is kind of disturbing however.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I thought so, but it seems like an error. I guess it would be easy to change by Scirra, but if changed it will properly break games that depends on this rather strange and wrong (IMO) behavior.

    I wonder how to fix the issue in the attached capx project? Beginning to mangle with coordinates to ensure correct scale seems not that trivial.

  • I thought so, but it seems like an error. I guess it would be easy to change by Scirra, but if changed it will properly break games that depends on this rather strange and wrong (IMO) behavior.

    I wonder how to fix the issue in the attached capx project? Beginning to mangle with coordinates to ensure correct scale seems not that trivial.

    Maybe the viewport expressions (viewportleft, viewportright, viewporttop, viewportbottom) could let you do this (you will be able to set the position of the origin relative to those).

  • Closing as not a bug. All four objects are set to anchor to the window top-left, and it is working correctly given those settings. (Note anchoring works by aligning the bounding box edges, not the origin, so you should not expect that it adjusts relative to the origin either.)

  • Ok. Thanks for explaining.

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