Tarion Posted January 6, 2014 Share Posted January 6, 2014 I used the font from the example (just to be sure, after mine had the same error)preload() { this.load.bitmapFont('desyrel', 'fonts/desyrel.png', 'fonts/desyrel.xml');}create() { var text = this.add.bitmapText(this.world.centerX, this.world.centerY, 'xx', { font: '64px desyrel', align: 'center' });} %c %c %c Phaser v1.1.3 - Renderer: Canvas - Audio: WebAudio %c %c background: #00bff3 background: #0072bc color: #ffffff; background: #003471 background: #0072bc background: #00bff3 phaser.js:13074:29 Uncaught TypeError: Cannot read property 'size' of undefined phaser.js:7181:41 PIXI.BitmapText.updateText phaser.js:7181:41 PIXI.BitmapText phaser.js:7124:14 Phaser.BitmapText phaser.js:20364:25 Phaser.GameObjectFactory.bitmapText phaser.js:17613:35 PhaserGameState.create app.ts:68:37 Phaser.StateManager.loadComplete phaser.js:9324:39 Phaser.Game.loadComplete phaser.js:13134:24 Phaser.SignalBinding.execute phaser.js:9996:48 Phaser.Signal.dispatch phaser.js:9871:84 dispatch phaser.js:9638:46 Phaser.Loader.nextFile phaser.js:32194:37 Phaser.Loader.xmlLoadComplete phaser.js:32146:18 _xhr.onload phaser.js:31961:42Uncaught TypeError: Cannot read property 'Sprite' of undefined app.ts:111:43 PhaserGameState.update app.ts:111:43 Phaser.StateManager.update phaser.js:9367:39 Phaser.Game.update phaser.js:13166:28 Phaser.RequestAnimationFrame.updateRAF phaser.js:23204:23 _onLoop phaser.js:23189:34 Any idea? Struggeling for a while with it now. Debugging the code: Error line:var data = PIXI.BitmapText.fonts[this.fontName];- data is undefined.- this.fontName is desyrel Link to comment Share on other sites More sharing options...
Tarion Posted January 6, 2014 Author Share Posted January 6, 2014 Wow: Desyrel != desyrel The case matters, but only on the add.bitmapFont(...) See: http://gametest.mobi/phaser/examples/_site/view_lite.html?d=text&f=bitmap+fonts.js&t=bitmap%20fonts The error handling is quite bad. Maybe the exception can be more explicit. But for me it's fixed. Link to comment Share on other sites More sharing options...
rich Posted January 6, 2014 Share Posted January 6, 2014 Actually it's here that the case matters, as the font name given has to match what is defined in the XML file.{ font: '64px desyrel' Link to comment Share on other sites More sharing options...
Heppell08 Posted January 30, 2014 Share Posted January 30, 2014 Actually it's here that the case matters, as the font name given has to match what is defined in the XML file.{ font: '64px desyrel'Yeah this fixed it for me!!! Thanks Rich Link to comment Share on other sites More sharing options...
Recommended Posts