Jump to content

Load image from another Scene


sanlegas
 Share

Recommended Posts

Hi everyone, i hope you can help me with this problem, i'm triying to load an image in SceneB that i have already loaded in SceneA but at the moment i want to use in SceneB this doesn't show in SceneB only displays a small green box.

Example:


 class SceneA extends Phaser.Scene{

    constructor(){
        super({key:'loader',activated:true});
    }

     preload ()
    {
      
       this.load.image('fondo', 'assets/sky.jpg');
       this.scene.start("menu");
    }
 }

 

class SceneB extends Phaser.Scene{

    constructor(){
        super({key:'menu',activated:false});
    }

    create(){

      var cielo   =   this.add.sprite(0 , 0, 'fondo');
      
    }

     preload ()
    {
      console.log("menu.js preload");

    }
 }

 

thanks for reading!.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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