How to use the phaser.Text function in phaser

To help you get started, we’ve selected a few phaser examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pixelpicosean / slush-phaser-project / templates / project / js / classes / Label.js View on Github external
var Label = function (x, y, textContent, fontStyle) {

  // set a basic style
  var style = fontStyle || {
    font: '30px Arial',
    fill: '#4488cc',
    align: 'center'
  };

  // call the superclass method
  Phaser.Text.call(this, game, x, y, textContent, style);
  this.anchor.setTo(0.5, 0.5);

};
github pixelpicosean / slush-phaser-project / templates / project / js / classes / Label.js View on Github external
var Label = function (x, y, textContent, fontStyle) {

  // set a basic style
  var style = fontStyle || {
    font: '30px Arial',
    fill: '#4488cc',
    align: 'center'
  };

  // call the superclass method
  Phaser.Text.call(this, game, x, y, textContent, style);
  this.anchor.setTo(0.5, 0.5);

};

Label.prototype = Object.create(Phaser.Text.prototype);
Label.prototype.constructor = Label;

module.exports = Label;
github Luchanso / bunny-funny-runner / src / game / game / actors / progress-bar.js View on Github external
addLabel(text) {
    const style = {
      fill: Phaser.Color.getWebRGB(this.color),
      font: '21px Open Sans'
    };

    const label = new Phaser.Text(this.game, 0, -30, text, style);

    this.addChild(label);
  }
github Luchanso / bunny-funny-runner / src / game / game / gui / lose-modal.js View on Github external
createLabel(x, y, text) {
    const { game } = this;
    const style = {
      font: '41px Open Sans',
      fill: 'white',
      align: 'center'
    };

    const label = new Phaser.Text(game, x, y, text, style);
    label.setShadow(0, 2, 'rgba(0, 0, 0, 0.2)', 6);
    label.anchor.setTo(0.5);

    return this.addChild(label);
  }