Jump to content

Is it possible to add tileSprite to physics?


Recommended Posts

I was noodling around and trying to create groups of game objects that had 3 sprites that were cropped from one image.  Similar to a 3-panel round cornered web button.  The reason for this structure is I need variable width with the outer left and right images being fixed.

But I also need it to be a game object with physics and collisions.  I tried adding tileSprite to physics to make this, but it did not work with physics. ("Error: Not a function")

this.blockLeftCap = this.physics.add.tileSprite(100,100,44,43,'button-001');

In the end I can just cut solo images individually, and then add as sprites to physics with no issue:

this.blockLeftCap = this.physics.add.sprite(100,100,'btn-001-cap-left');

 Since I can do this other ways it is no big deal.  But I did like the way tileSprite allowed for easily adjustment of the image cropping.

Just wanted to double check if I was missing something.



Link to comment
Share on other sites

  • 1 month later...

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.

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.


  • Recently Browsing   0 members

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