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

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

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