Hello Guest

Author Topic: tk2dSprite.SetSprite() bug?  (Read 4285 times)

DemiGoth

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 45
    • View Profile
tk2dSprite.SetSprite() bug?
« on: November 11, 2013, 07:26:56 am »
After my previous support request here, I think I might have found a bug with the tk2dSprite.SetSprite() method.

As said, I'm making a Tetris game, and for this I've created a sprite collection holding the 7 blocks that need to drop. For all of these blocks I've set their own polygon collider boundaries over the edges of the object. So far so good....
But when I change the Tetris block to play with using the tk2dSprite.SetSprite() method, the polygon collider of the 'default' block that I'm using on the camera sticks to the Tetris block. i.e. When I set the O (2x2 blocks) as default and I get an I (1x4 blocks), the collider is still set to the O (2x2 blocks).

I'm not sure if I miss something when changing sprite and have to change collider as well, but IMO when changing sprite the collider should change with it.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: tk2dSprite.SetSprite() bug?
« Reply #1 on: November 11, 2013, 11:33:37 am »
The reason it doesn't change polygon collider is performance, these are notoriously expensive to update.

2dddd

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: tk2dSprite.SetSprite() bug?
« Reply #2 on: July 24, 2014, 09:16:00 pm »
I've been having a similar issue. When I used SetSprite(), the sprite would change to the correct sprite, but it would not change the collider along with it. However, after I deleted all of the related sprites from my sprite collection and then once again added them to the sprite collection and gave them new colliders in the sprite collection window, then there was no problem at all and it would change the colliders just fine.