Jump to content

Move the body of an image


Disuqi
 Share

Recommended Posts

So I have a Physics.image in my scene and I want the body of that image to be smaller than the image. The game object is called house and what I did was

this.house.body.setSize(50, 80, false); this worked just fine and the size of the body got smaller. However it's on the top left of the house, and this is normal because that is the center of the image. I tried using house.body.setOffset() but it wouldnt work, i tried messing around for a bit with other things, but nothing worked, I cant move the body.

this.house = game.physics.add.image(1050, 520, 'house');
this.house.body.allowGravity = false;
this.house.body.setSize(50, 80, true);
image.png.9d6df45b0b03a4141aff4589e00313ef.png

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...