dmcb / spectrum-slider

1 stars 0 forks source link

Collision Categories/Masks are wrong on game start #3

Closed savethejets closed 12 years ago

savethejets commented 12 years ago

When you start the game the Yellow collision seems to be enabled even though the yellow layer isn't visible.

When you switch to yellow, then back to red the yellow is no longer enabled and then the game works like expected from that point on.

I imagine this is an initialization issue.

dmcb commented 12 years ago

This is fixed by 76e702f983a4a8d9b35d6f2ff49176d4784316c7. I'm not entirely sure why spawning the player after activating the dimensions clears this up. Any explanation?

savethejets commented 12 years ago

setDimension will set the collision on the player to the red collision.

But when you create a player their collision is set to be ALL_COLLISION.

So if you set it to red before creating the player, the game will have red collision and the player will have ALL_COLLISION.