Phaser loads images dynamically after preloading

I’m working on a game with Phaser. This game rewards the player with an item that cannot be preloaded. After calling Ajax, I was hoping to upload an image and then display it in a phaser animation. Is there any way to do this?

Stream: The game plays Endgame and Ajax Call. Ajax answers which image to use. Phaser uploads the image and displays that they won.

+4
source share
1 answer

You can use the Phaser downloader to download the image at any time by calling

game.load.image('referenceName', 'assets/pics/file.jpg');

, http://phaser.io/examples/v2/loader/load-events

game.load.onLoadComplete.add(aFunctionToCall, this);

, .

game.load.start();

+10

All Articles