Scaling anchored sprites does not take origin into account

Bugs will be moved here once resolved.

Post » Wed Nov 19, 2014 9:45 pm

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
You do not have the required permissions to view the files attached to this post.
Kind Regards,
Mikael Thomsen
www.solunasoftware.com
B
53
S
24
G
2
Posts: 46
Reputation: 5,042

Post » Wed Nov 19, 2014 10:53 pm

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.
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
53
S
22
G
18
Posts: 2,122
Reputation: 17,123

Post » Wed Nov 19, 2014 11:16 pm

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. :-(
Kind Regards,
Mikael Thomsen
www.solunasoftware.com
B
53
S
24
G
2
Posts: 46
Reputation: 5,042

Post » Thu Nov 20, 2014 2:01 pm

Soluna Software wrote: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).
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
53
S
22
G
18
Posts: 2,122
Reputation: 17,123

Post » Thu Nov 20, 2014 5:07 pm

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.)
Scirra Founder
B
395
S
231
G
88
Posts: 24,367
Reputation: 193,694

Post » Thu Nov 20, 2014 8:14 pm

Ok. Thanks for explaining. :-)
Kind Regards,
Mikael Thomsen
www.solunasoftware.com
B
53
S
24
G
2
Posts: 46
Reputation: 5,042


Return to Closed bugs

Who is online

Users browsing this forum: No registered users and 1 guest