Added BitmapFont to the GameObjectFactory.

This commit is contained in:
photonstorm
2014-02-14 06:16:36 +00:00
parent 15b83e1c88
commit 7d2a818d0d
3 changed files with 44 additions and 22 deletions
+13 -16
View File
@@ -3,39 +3,36 @@ var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: p
function preload() {
game.load.image('font', 'assets/fonts/gold_font.png');
game.load.image('goldFont', 'assets/fonts/gold_font.png');
game.load.image('bluePink', 'assets/fonts/bluepink_font.png');
}
var font;
var font1;
var font2;
function create() {
// text = game.add.bitmapText(100, 100, 'carrier', 'Phaser and Pixi\nrocking!', 32);
font1 = game.add.bitmapFont(game.world.centerX, 96, 'goldFont', 16, 16, "! :() ,?." + Phaser.BitmapFont.TEXT_SET10, 20, 0, 0);
font1.text = "phaser brings you retro style bitmap fonts";
font1.anchor.set(0.5);
font = new Phaser.BitmapFont(game, 'font', 16, 16, "! :() ,?." + Phaser.BitmapFont.TEXT_SET10, 20, 0, 0);
font2 = game.add.bitmapFont(game.world.centerX, 300, 'bluePink', 32, 32, Phaser.BitmapFont.TEXT_SET2, 10);
font2.setText("phaser is\nrocking :)", true, 0, 8, Phaser.BitmapFont.ALIGN_CENTER);
font2.anchor.set(0.5);
font.text = "using bitmap fonts rocks";
game.world.add(font);
// font = new FlxBitmapFont(AssetsRegistry.goldFontPNG, 16, 16, "! :() ,?." + FlxBitmapFont.TEXT_SET10, 20, 0, 0);
// font.setText("using bitmap fonts\nin flixel is", true, 0, 8, FlxBitmapFont.ALIGN_CENTER, false);
// game.input.onDown.add(change, this);
game.input.onDown.add(change, this);
}
function change() {
// text.align = 'center';
// text2.tint = Math.random() * 0xFFFFFF;
font2.tint = Math.random() * 0xFFFFFF;
}
function update() {
// text.text = 'Phaser & Pixi\nrocking!\n' + Math.round(game.time.now);
font2.rotation += 0.03;
}