Search the Community
Showing results for tags 'floating'.
-
I have a staticGroup of floating coins from a tilemap and I wanted to make the collision area circular and the correct size however: I tried calling `setCircle` on each object in the group but it has no effect. If I change the staticGroup to a group, I can see the circle form when using debug mode. However this then subjects the group to gravity and my objects fall out of the game Here's the relevant code: function create() { var coinTiles = map.addTilesetImage('coin'); coinLayer = map.createDynamicLayer('Coins', coinTiles, 0, 0); // I tried changing this to this.physics.add.group(); coinGroup = this.physics.add.staticGroup(); // Loop over each Tile and replace sprite coinLayer.forEachTile(tile => { if (tile.index === 17) { const x = tile.getCenterX(); const y = tile.getCenterY(); const coin = coinGroup.create(x, y, "coin"); // This line seems to have no effect on static objects. coin.body.setCircle(10, 10 , 10); coinLayer.removeTileAt(tile.x, tile.y); } }); // etc... } staticGroup: Group: (ignore circle offset being completely off)
- 5 replies
-
- floating
- staticgroup
-
(and 3 more)
Tagged with: