Cawrtz Posted June 3, 2015 Report Share Posted June 3, 2015 Hi I would like to tween my sprite when it falls on a platform to make it look like a slime (increase its width and decrease its height, then back to normal).The problem is that I've enabled Arcade physics on it, and the body (body.width, body.height) is always adjusting to its visual size (sprite properties .width and .height).game.add.tween(this).to({ width: currentWidth + 10, height: currentHeight - 10}.onComplete.add(tweenBackToNormalSize);That creates opportunities to glitch underneath platforms and many other unwanted side effects. Is there a way I can get this effect without changing the hitbox ? Thanks in advance!Yann Quote Link to comment Share on other sites More sharing options...
drhayes Posted June 3, 2015 Report Share Posted June 3, 2015 What happens if you tween the scale.x/y, instead? I *believe* that just changes the texture, not the physics properties. Quote Link to comment Share on other sites More sharing options...
Cawrtz Posted June 3, 2015 Author Report Share Posted June 3, 2015 Hi drhayes, thanks for your answer!I used scale instead of my width and height calculationsUnfortunately, it stills affects the physics body... Maybe I could use another (visible) sprite that follows the (hidden) sprite body to bypass the issue? Quote Link to comment Share on other sites More sharing options...
drhayes Posted June 4, 2015 Report Share Posted June 4, 2015 Ah, shoot. I had high hopes for that answer. ( = You might be right -- there's the sprite and its body and the sprite has a child image or something. Cawrtz 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.