SetSize() for StaticImage


#1

I need a StaticImage as a platform and I need to SetSize it :

  • to make new collision box smaller than the original sprite
  • to “center it on the gameobject”
    What is the best way, please ?

I used this SetSize() : https://github.com/photonstorm/phaser/blob/v3.16.0/src/physics/arcade/StaticBody.js#L514

Example : https://codepen.io/Tonio24100/pen/MLEzNd


#2

Seems best to position the body manually and then use body.setSize(…).


#3

Perfect answer ! Thank you very much. And I saw you’ve alredy opened an issue.
Sorry to not have find your last posts in the forum and issues…
I will try to do better :star_struck: