phaser/examples/wip/bitmaptext3.js

33 lines
790 B
JavaScript
Raw Normal View History

2014-02-14 12:07:04 +00:00
// var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update });
var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create, update: update });
2014-02-14 12:07:04 +00:00
function preload() {
game.load.image('knightHawks', 'assets/fonts/KNIGHT3.png');
}
var font;
var i;
2014-02-14 12:07:04 +00:00
function create() {
font = game.add.bitmapFont('knightHawks', 31, 25, Phaser.BitmapFont.TEXT_SET6, 10, 1, 1);
font.text = 'phaser was here';
2014-02-14 12:07:04 +00:00
for (var c = 0; c < 19; c++)
{
var i = game.add.image(game.world.centerX, c * 32, font);
i.tint = Math.random() * 0xFFFFFF;
i.anchor.set(0.5, 1);
}
2014-02-14 12:07:04 +00:00
}
function update() {
font.text = "phaser x: " + game.input.x + " y: " + game.input.y;
2014-02-14 12:07:04 +00:00
}