Search the Community
Showing results for tags 'body size'.
-
If I do this: function paddleUpdate() { if(isPaddleNerfed) { paddle.frameName = "paddle_small.png"; //48px width } else { paddle.frameName = "paddle_big.png"; //32px width } //Do I have to set the size manually like this paddle.body.setSize(paddle._cache.width, paddle._cache.height); } I ask because with: game.debug.renderSpriteBounds(paddle); I see the pink border and it's changing size (but only visually): collisions and also sprite.body.width still returns the old bigger size rather than the smaller/nerfed one... Also visually it's all ok... and also sprite._cache.width returns correct values. Is my aproach right or is there a better, shorter way ... i clearly understand that it can't and shouldn't be automatic because changing sprite/frames should change the collision body region... but maybe it can be added as option ... or maybe shouldn't I'll be glad to here more opinions about this. EDIT: I just saw that there is: game.debug.renderSpriteBody(paddle); so the only question that leave is this the proper way of doing it since the sprite.body isn't updating on sprite size/frame change
- 4 replies
-
- sprite size
- frame
-
(and 2 more)
Tagged with: