Jump to content

Nine Patch Plugin for Phaser


netcell
 Share

Recommended Posts

Hello! I really would like to start using this for my bullet hell Phaser game, but I'm having an issue where, when I load the Ninepatch image, I get an error in the function NinePatchCache on this line: 

this.baseTexture = PIXI.BaseTextureCache[imageKey] ? PIXI.BaseTextureCache[imageKey] : imageCache.base;

 

It says "Cannot read property 'base' of undefined". 

 

Here's some of my relevant code:

splash.js (a splash screen game state)

 

@preload

        // Load everything
        this.status.setText('Loading Scripts...'); this.loadScripts();
        this.status.setText('Loading Images...'); this.loadImages();
        this.status.setText('Loading NinePatches...'); this.loadNinePatches();
        this.status.setText('Decoding Sounds...'); this.loadSounds();
        this.status.setText('Decoding Fonts...'); this.loadFonts();

 

@loadImages
        game.load.atlasJSONHash('ui-atlas', 'assets/images/game/ui.png', 'assets/images/game/ui.json');

 

@loadNinePatches

        // I didn't change the numbers from the example because I just wanted to tinker with it first
        game.cache.addNinePatch('metalPanel_purpleCorner', 'ui-atlas', 'metalPanel_purpleCorner', 10, 10, 10, 20);

 

I made the atlasJSONHash with TexturePacker, so I feel like that is pretty solid. I'm able to get the metalPanel_purpleCorner from the atlas and use it as a sprite just fine, so I don't think it's that.

It's also worth noting that I'm on Phaser v2.4.3.

Am I doing anything else wrong? This is my scripts at the bottom of my index.html:
 

    <script src="vendor/phaser.min.js"></script>
    <script src="vendor/jquery.min.js"></script>
    <script src="vendor/bootstrap.min.js"></script>
    <script src="vendor/ninepatch.min.js"></script>
    <script src="src/engine.js"></script>  
 
Engine.js just loads what it needs for the splash/loading screen state.
 
I tried throwing these scripts to the head of my index.html, but that didn't work.
 
Any ideas?
 
Thank you so much for your time!
Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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