Hello Guest

Author Topic: Getting Bounds from a Diced sprite  (Read 4883 times)

Ricky Walton

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 11
    • View Profile
Getting Bounds from a Diced sprite
« 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
« Last Edit: February 25, 2014, 03:48:19 pm by Ricky Walton »

Ricky Walton

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: Getting Bounds from a Diced sprite
« Reply #1 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.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Getting Bounds from a Diced sprite
« Reply #2 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...

Ricky Walton

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: Getting Bounds from a Diced sprite
« Reply #3 on: February 25, 2014, 05:36:58 pm »
Thank you. That would have helped, didn't notice that in the sprite. Next time ;)