Jump to content

Loading images after preload gives error


Nulligma
 Share

Recommended Posts

I am making a game with skins in it. When ever player changes a skin Images gets loaded again. I use this code. 

preload: function () 
    {
        this.load.image('arm', 'asset/Theme'+this.theme+'/arm.png');
        this.load.image('leg', 'asset/Theme'+this.theme+'/leg.png');
        this.load.image('head', 'asset/Theme'+this.theme+'/head.png');
        this.load.image('torso', 'asset/Theme'+this.theme+'/torso.png');
    }

gameFunction:function()
{
   if(this.themeChanged)
            {
                this.theme = this.newTheme;
                game.lockRender = true;
                game.load.onLoadComplete.add(this.preloadComplete, this);
                this.preload();
                game.load.start();
             }
}

    
    preloadComplete:function()
    {
        game.load.onLoadComplete.remove(this.preloadComplete, this);
        game.lockRender = false;

        this.addImages();
    },

This gives me an error

Quote

Uncaught TypeError: Failed to execute 'drawImage' on 'CanvasRenderingContext2D': No function was found that matched the signature provided. 

What am I doing wrong here?

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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