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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

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