netgfx / Phaser-typewriter

A phaser helper for the typewriter effect
MIT License
38 stars 8 forks source link

Error when not setting bitmap font #6

Open eduardobreno opened 7 years ago

eduardobreno commented 7 years ago

Hi, I'm getting this error when I dont use bitmap font.

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

phaser.min.js:3 Uncaught TypeError: Cannot read property 'font' of null
    at c.BitmapText.updateText (phaser.min.js:3)
    at new c.BitmapText (phaser.min.js:3)
    at c.GameObjectFactory.bitmapText (phaser.min.js:3)
    at enableTypingSpecificMessage (typewriter.js:45)
    at start (typewriter.js:26)
    at Object.start (typewriter.js:111)
    at EJ.Story.create (Story.js:20)
    at c.StateManager.loadComplete (phaser.min.js:3)
    at c.Loader.finishedLoading (phaser.min.js:3)
    at c.Loader.processLoadQueue (phaser.min.js:3)

Here my code, even if I comment fontFamily it return error.

    var typewriter = new Typewriter();
    typewriter.init(game, {
        x: 290,
        y: 40,
        fontFamily: "Arial",
        fontSize: 26,
        maxWidth: 300,
        sound: this.game.add.audio('track'),
        text: "Some text to be typed!"
    });
    typewriter.start();

Any suggestions?

netgfx commented 7 years ago

Unfortunately currently this plugin only supports bitmap text, because it needs to pick letter by letter. I might look into it to support normal text as well.