Tee Posted August 23, 2018 Share Posted August 23, 2018 Hi - First off, Phaser is awesome, and I'm having a blast playing around with it. Unfortunately I've run into a problem, and most likely it's just my noobishness. Here's my relevant code (the x/y coordinates and other numbers are arbitrary): platforms = this.physics.add.staticGroup(); foregroundTile = this.add.tileSprite(100,100,200,'foregroundGraphic').setScale(.5); this.physics.add.existing(foregroundTile,platforms); foregroundTile.setOffset(0,60).refreshBody(); This bit of code throws the error: foregroundTile.setOffset is not a function I'm using Phaser 3.11.0. All I want to do really is set the offset below the top edge of the foreground graphic, so a collision/overlap occurs y pixels below the edge of the image. Maybe I should just create a custom hitbox instead? The issue does seem to be related to this one. Thanks for any help. Link to comment Share on other sites More sharing options...
rich Posted August 23, 2018 Share Posted August 23, 2018 Your call to `add.existing` has the wrong parameters. The 2nd one should be a boolean, but you're passing in a Group instead. However, even with that fixed it will still error - the `setOffset` call is available only on objects created in the factory, but your TileSprite wasn't, so instead replace it with `foregroundTile.body.setOffset` (and the same for refreshBody) Link to comment Share on other sites More sharing options...
Tee Posted August 24, 2018 Author Share Posted August 24, 2018 Thanks Rich for the help and explanation. Link to comment Share on other sites More sharing options...
Recommended Posts