Jump to content

Phaser 2: Can`t load image after preload() function


Recommended Posts

var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create});
function preload(){
      game.load.image('tardis', "./tardis.jpg");
function create() {
       game.stage.backgroundColor = '#182d3b';
       var sprite1 = game.add.sprite(40, 100, 'tardis');

       //if i move it to preload t works fine

      game.load.image('flower', './flower.jpeg');

      var sprite2 = game.add.sprite(100, 100, 'flower');
      //Phaser.Cache.getImage: Key "flower" not found in Cache
Link to comment
Share on other sites

  • 1 month later...

  • Recently Browsing   0 members

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