Bike Posted September 19, 2018 Share Posted September 19, 2018 var rect = new Phaser.Geom.Rectangle(0, 440, 800, 160); var graphics = this.add.graphics({ fillStyle: { color: 0x0000ff } }); graphics.fillRectShape(rect); var style = { fontSize: 24, fontFamily: 'Arial', align: "center" } prize_text = this.add.text(300,525, "text", style); prize_text.setTextBounds(0,440,800,160); New to Phaser 3 and I am trying to create a boundary to center text within but setTextBounds doesn't appear to be working. (Errors that it isn't a function) Is this a Phaser 2 thing? Is there an equivalent in Phaser 3? Link to comment Share on other sites More sharing options...
Bike Posted September 20, 2018 Author Share Posted September 20, 2018 Still having trouble with this, I see you can get bounds in the documentation but I don't see any way to set the boundary limits in phaser 3. Link to comment Share on other sites More sharing options...
samme Posted September 20, 2018 Share Posted September 20, 2018 You may not need a boundary for centering: this.add.text(300, 525, "text", style).setOrigin(0.5, 0.5); or Phaser.Display.Align.In.Center(text, this.add.zone(x, y, width, height)); Link to comment Share on other sites More sharing options...
Recommended Posts