Jump to content

Is it possible to add tileSprite to physics?


msickle
 Share

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.

Thanks,

Matt

Link to comment
Share on other sites

  • 1 month later...
 Share

  • Recently Browsing   0 members

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