{"size": 796, "ext": "js", "max_stars_repo_path": "examples/text/center text on sprite.js", "max_stars_repo_name": "raresabie/game-exemples", "max_stars_repo_stars_event_min_datetime": "2015-01-01T05:52:34.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-18T17:02:09.000Z", "max_issues_repo_path": "examples/text/center text on sprite.js", "max_issues_repo_name": "raresabie/game-exemples", "max_issues_repo_issues_event_min_datetime": "2015-01-17T16:08:08.000Z", "max_issues_repo_issues_event_max_datetime": "2021-04-24T11:09:20.000Z", "max_forks_repo_path": "examples/text/center text on sprite.js", "max_forks_repo_name": "raresabie/game-exemples", "max_forks_repo_forks_event_min_datetime": "2015-01-01T00:42:33.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-31T10:40:37.000Z"}
{"max_stars_count": 1552, "max_issues_count": 95, "max_forks_count": 1322, "avg_line_length": 24.1212121212, "max_line_length": 146, "alphanum_fraction": 0.6494974874}

var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update });

function preload() {

    game.load.image('pic', 'assets/pics/fof_background.png');

}

var sprite;
var text;

function create() {

    game.stage.backgroundColor = 0x5d5d5d;

    sprite = game.add.sprite(200, 200, 'pic');
    sprite.inputEnabled = true;
    sprite.input.enableDrag();

    var style = { font: "32px Arial", fill: "#ff0044", wordWrap: true, wordWrapWidth: sprite.width, align: "center", backgroundColor: "#ffff00" };

    text = game.add.text(0, 0, "- text on a sprite -\ndrag me", style);
    text.anchor.set(0.5);

}

function update() {

    text.x = Math.floor(sprite.x + sprite.width / 2);
    text.y = Math.floor(sprite.y + sprite.height / 2);

}