Jump to content

Error BitmapFont on refresh


Papz
 Share

Recommended Posts

Hi,
i need help,

i get this when i refresh my game 1/2:

Quote

Phaser.Cache.getBitmapFont: Key "pixel" not found in Cache.

and ofc (game.js 50)

console:

Quote

Uncaught TypeError: Cannot read property 'font' of null

and in game.js line 50:

this.rep_un_txt = this.game.add.bitmapText(this.raw_gauche_center, 0, 'pixel', this.rep_un, 100);

i load 2 bitmap font in my load.js:

gameState.loadState = function(game) { };
gameState.loadState.prototype ={
	preload: function(){
            //assets
            this.game.load.image('barRep','./assets/bar_rep.png');
            this.game.load.image('selecteur','./assets/selecteur.png')
            //fonts
            this.game.load.bitmapFont('pixel', './font/pixelBITM.png', './font/pixelBITM.fnt');
            this.game.load.bitmapFont('pixel_o', './font/pixelBITM_o.png', './font/pixelBITM_o.fnt');

            this.game.load.onLoadComplete.add(this.start, this);
	},
	start: function(){
            // i use this for fix error (cheap)
            this.fixtext = this.add.text(-10, -10, {font: "1px pixel", fill: "#ffffff"});
            this.state.start('Game');
	}
};


I can't found a fix or see what i m doing wrong :/

Early Thanks :P

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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