msickle Posted March 31, 2018 Share Posted March 31, 2018 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 More sharing options...
LaserLemon Posted April 1, 2018 Share Posted April 1, 2018 Hey Matt! I'm pretty new here, this is my first post. I came across this while looking into my own physics issue, would this be what you're trying to achieve? https://labs.phaser.io/view.html?src=src\physics\matterjs\add body to tilesprite.js - Emile. Link to comment Share on other sites More sharing options...
msickle Posted April 2, 2018 Author Share Posted April 2, 2018 Actually animation frames on a sprite also works fine for this. Many ways to do what I need. And I checked src and the only GameObject types in arcade physics are Sprites and Images. Case closed. Link to comment Share on other sites More sharing options...
ChristopheL Posted May 6, 2018 Share Posted May 6, 2018 I found a way to use tileSprite with Arcade physics, i post it here cause it can be usefull for peoples who are searching on the web: var tileSprite = this.add.tileSprite(x, y, width, height, image); this.physics.add.existing(tileSprite); fariazz 1 Link to comment Share on other sites More sharing options...
Recommended Posts