2D Toolkit Forum

2D Toolkit => Support => Topic started by: pdform on February 05, 2013, 11:41:54 pm

Title: Anchors and Flip
Post by: pdform on February 05, 2013, 11:41:54 pm
Hi,

I've noticed that if you flip a sprite on the editor, the sprite's anchor keeps working as expected, however, if you flip it on runtime, some crazy behavior occurs. For instance, I've set a center anchor, and called FlipX on a sprite. Since the anchor is in the center, I'd expect the sprite to be flipped around the center, so the anchor would still be at the center, however, I observe it changes to pos.x - sprite width / 2. Is it normal?

Thanks!
Title: Re: Anchors and Flip
Post by: unikronsoftware on February 05, 2013, 11:47:50 pm
How have you set up the anchor?
Title: Re: Anchors and Flip
Post by: pdform on February 05, 2013, 11:49:01 pm
I've set it in the sprite collection, via editor. In my code I just call FlipX, I do not change the anchor anytime...
Title: Re: Anchors and Flip
Post by: unikronsoftware on February 05, 2013, 11:50:26 pm
What platform are you testing this on? It only happens when you're running the game in the player right?
Title: Re: Anchors and Flip
Post by: pdform on February 05, 2013, 11:54:21 pm
I haven't actually tested the current game in any target platform, only on the player. However, I remember having the same problem with iOS and Android in the final build, for another game. In that situation I had to treat specifically the case when the sprite's scale was negative, i.e, the sprite was flipped, to reposition it to the correct coordinates (for the new anchor).
Title: Re: Anchors and Flip
Post by: unikronsoftware on February 06, 2013, 12:03:07 am
I just tried this and I can't reproduce it. Can you send me a test case to support@unikronsoftware.com to look at it?
Title: Re: Anchors and Flip
Post by: pdform on February 06, 2013, 12:04:59 am
OK, I will. Thanks!