Jump to content

How to change the keys of existing images in Phaser?


weratius
 Share

Recommended Posts

Hello!

 

there is a boot.js file:

game.load.image('weapon_2_2', 'img/profile/res/' + playerInfoObject.w4.id + '.png');game.load.image('weapon_2_3', 'img/profile/res/' + playerInfoObject.w5.id + '.png');

I need to change the keys of already loaded images
 

I do this like that:

var loader = new Phaser.Loader(game);var myObject = this; //(my own parent object)loader.image('weapon_2_3', 'img/profile/res/' + playerInfoObject.w4.id + '.png', true);loader.image('weapon_2_2', 'img/profile/res/' + playerInfoObject.w5.id + '.png', true);loader.onLoadComplete.add(myObject.refresh);// Why can't I just load image without any callback (onLoadComplete)?//If I delete this callback method the loader won't work at allloader.start(); 

and here is the problem: 

 

I don't need a callback method (refresh method is empty)

 

I have problems smth like that (On image)

 

 

What should I do? Thank you =)

post-14308-0-38810100-1435915028.png

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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