Polska296 Posted May 18, 2018 Share Posted May 18, 2018 I found that you could use this.scene.start('Scene2', {Level : 2, Health : this.hero.health}) to pass data to another scene. However the next step I see in every example online is what confuses me which uses init in the next scene to get the data. Any time I use init, I get an error saying either init or data is not defines. Would someone be able to show me an example of passing the data to another scene and then logging the data in the console when moving to the new scene? Link to comment Share on other sites More sharing options...
samme Posted May 19, 2018 Share Posted May 19, 2018 http://labs.phaser.io/view.html?src=src\scenes\passing%20data%20to%20a%20scene.js&v=dev OneSillyLion, blackhawx and garry 3 Link to comment Share on other sites More sharing options...
eddieone Posted January 18, 2019 Share Posted January 18, 2019 not very seo friendly ? Link to comment Share on other sites More sharing options...
emc Posted September 26, 2019 Share Posted September 26, 2019 you need to pass data into the init function. So if you have this.scene.start('game', { level: 1 }) then in your game scene you need init(data){ this.level = data.level; } TechnoL0g and FKL34TI5T5 1 1 Link to comment Share on other sites More sharing options...
Recommended Posts