jotaSe Posted February 16, 2014 Share Posted February 16, 2014 Well, I never got an answer, but I'll try again, I'm having this error Uncaught TypeError: Cannot call method 'split' of undefined (19:27:56:417 | error, javascript)at b.BitmapText.setStyle (libs/phaser.min.js:4:3571) when I do this credits = game.add.bitmapText(game, game.world.width / 2, 10, 'Credits', { font: '12px font', align: 'center' });And this is how I call it : game.load.bitmapFont('font', 'font/font.png', 'font/font.xml'); Any help? Link to comment Share on other sites More sharing options...
jotaSe Posted February 16, 2014 Author Share Posted February 16, 2014 Btw, I'm using phaser 1.1.5 Link to comment Share on other sites More sharing options...
rich Posted February 16, 2014 Share Posted February 16, 2014 You don't need the first parameter (game), it's throwing everything else out. If in doubt, look at the examples: http://examples.phaser.io/_site/view_full.html?d=text&f=bitmap+fonts.js&t=bitmap%20fonts Link to comment Share on other sites More sharing options...
jotaSe Posted February 16, 2014 Author Share Posted February 16, 2014 Hi Rich, I use the (game) parameter because the docs said that new BitmapText(game, x, y, text, style)but avoiding that, new BitmapText( x, y, text, style)I get another error Uncaught TypeError: Cannot read property 'size' of undefined (22:30:10:198 | error, javascript)at b.BitmapText.updateText (libs/phaser.min.js:4:3862) Link to comment Share on other sites More sharing options...
rich Posted February 16, 2014 Share Posted February 16, 2014 You're not creating a new BitmapText though, you're getting one from the GameObjectFactory, so the parameter isn't needed then. Is your font actually called 'font' ? I doubt it personally Open the XML file and read what the fonts name really is, because that is what it's expecting in the font object. Here's an example:<font> <info face="Desyrel" size="70" bold="0" italic="0" chasrset="" unicode="0" stretchH="100" smooth="1" aa="1" padding="0,0,0,0" spacing="1,1"/>The "face" node is the actual font name. Note that in Phaser 1.1.5 you can't use fonts with spaces in the name (due to an underlying issue Pixi has with that) but we fixed this in 1.2. In the meantime you can simply edit the xml file and remove any spaces the name might have. Link to comment Share on other sites More sharing options...
jotaSe Posted February 16, 2014 Author Share Posted February 16, 2014 Thx, the problem was that, i create a font called "myfont" and in the xml file it was face = "Myfont", I change that and it works! Thx for all Link to comment Share on other sites More sharing options...
Recommended Posts