2D Toolkit Forum

2D Toolkit => Support => Topic started by: Ricky Walton on February 25, 2014, 03:45:25 pm

Title: Getting Bounds from a Diced sprite
Post by: Ricky Walton on February 25, 2014, 03:45:25 pm
Hi,

We have some art changes in our game that required me to switch from a regular sprite to a diced sprite. We have been using GetBounds() on the sprite to get it's width for alignment. Since the change to a diced sprite I'm not getting the full size of the sprite. Is there something else I need to be using to get the total size of the sprite?

Thanks
Title: Re: Getting Bounds from a Diced sprite
Post by: Ricky Walton on February 25, 2014, 04:47:02 pm
Resolved! The issue was not the diced sprite.

When querying the bounds (upon instantiation) the sprite was in the incorrect state. The cause of confusion was I saw the sprite displaying the correct new image, yet the supposed size was much smaller then expected.

It's strange as we set the clip to play on instantiation and I think this was the issue as the animation data being out of date, pointing at a sprite that is no longer in the collection. Not sure how it was displaying the correct sprite though?

Sorry the details are hard to explain... if I can answer any further queries on what we saw I'll be happy to help.
Title: Re: Getting Bounds from a Diced sprite
Post by: unikronsoftware on February 25, 2014, 05:06:15 pm
If you called GetBounds on the sprite, you should be able to see what sprite is bound to it. If you look at the code of that function, you should be able to just print out the name to see what its currently bound to...
Title: Re: Getting Bounds from a Diced sprite
Post by: Ricky Walton on February 25, 2014, 05:36:58 pm
Thank you. That would have helped, didn't notice that in the sprite. Next time ;)