Jump to content

player.body.setSize Doesn't Exist


jasonstockton
 Share

Recommended Posts

I'm trying to set the collision bounds of a sprite and from what I can tell player.body.setSize(w,h,x,y) is the way I do it.

 

When I apply it it's saying the function doesn't exist on the object. When I have a look at the object it's not there. 

 

I'm using version 1.1.5

 

Is there a new way to do this or is it not supported on 1.1.5?

Link to comment
Share on other sites

I think the function you are looking for is setRectangle.

player.body.setRectangle(w, h, translateX, translateY);

From the docs

width number <optional>

The width of the rectangle. If not specified it will default to the width of the parent Sprite.

height number <optional>

The height of the rectangle. If not specified it will default to the height of the parent Sprite.

translateX number <optional>

The x amount the rectangle will be translated from the Sprites center.

translateY number <optional>

The y amount the rectangle will be translated from the Sprites center.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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