3.1.0 Phaser.Physics.Arcade.Sprite Resizing Doesn't Work #3247
Comments
Use |
Oh thank you that worked. But now, image and body moves seperately, https://i.hizliresim.com/bBLPdb.png
|
Yeah it seems like the physics body doesn't correctly update after modifying the sprite scale. EDIT: probably due to sprite having default pivot/anchor/origin at their center? |
@agilul Thanks, with your comment, I discovered that, we need to set display origin 0 before resizing:
I used to scale everything mathematically on my previous games, that will be hard to get used to for me. |
The physics body align issue has been solved in PR #3300 |
Sweet, thanks @pixelpicosean |
Hi Everyone,
I am trying to move into Phaser 3.1.0, this is my very first step into Phaser 3. I initialized a scene using Arcade Physics, everything is working great but i can not resize Sprites.
create: function(){ this.physics.world.setBounds(0, 0, 400, 400); var star = this.physics.add.sprite(128, 128, 'star'); star.width = 20; star.height = 20; star.setGravity(40, 100); star.setBounce(1).setCollideWorldBounds(true); },
According to documentation width is defined as:
I think it is an issue about scaling game objecs.
Thanks every greate one in this great community!
The text was updated successfully, but these errors were encountered: