Jump to content

Loading webfonts


agvse0
 Share

Recommended Posts

Hi guys,

So I've been fiddling around with phaser but I got stuck several hours ago and I can't work this one out: loading webfonts. The example on phaser.io works fine but whenever I try to implement it in my state, it fails:

 


var startGame = {
	preload : function() {
		this.game.stage.backgroundColor = config.baseBackground;
		this.groundSprite = game.load.image('groundSprite',
				assets.game.groundSprite.asset);
		this.groundMovement = game.add.group();
		this.game.load.script('font.baloo',
				'//ajax.googleapis.com/ajax/libs/webfont/1.4.7/webfont.js');
	},
	create : function() {
		//this.loadTileMap();
		var style = {
			font : '40px Baloo',
			fill : '#fff',
			align : 'center'
		};

		var text = this.game.add.text(this.game.world.centerX,
				this.game.world.centerY, 'Yeah - webfont loaded!', style);
		text.anchor.set(.5, .5);
	},
	update : function() {
	}
}

Result

 

What am I doing wrong?

Thanks!

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...