Advertisement
nPhoenix

Phaser 3 Scene test

Mar 26th, 2019
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var A = {};
  2.  
  3. A.Extends = Phaser.Scene;
  4.  
  5. A.initialize = function () {
  6.     Phaser.Scene.call(this, {key: "sceneA"});
  7. };
  8.  
  9. A.init = function (data) {
  10.     console.log("Scene A Init", data);
  11. };
  12.  
  13. A.create = function () {
  14.     console.log("Scene A");
  15. };
  16.  
  17. var SceneA = new Phaser.Class(A);
  18.  
  19. var Battle = {};
  20.  
  21. Battle.Extends = Phaser.Scene;
  22.  
  23. Battle.initialize = function () {
  24.     Phaser.Scene.call(this, {key: "battle"});
  25. };
  26.  
  27. Battle.create = function () {
  28.     console.log("Battle Scene");
  29.     this.scene.start("sceneA", {xsd:123, abc:321});
  30. };
  31.  
  32. var BattleScene = new Phaser.Class(Battle);
  33.  
  34. var config = {
  35.     type: Phaser.AUTO,
  36.     width: 800,
  37.     height: 600,
  38.     parent: 'game',
  39.     scene: [ BattleScene, SceneA ]
  40. };
  41.  
  42. var game = new Phaser.Game(config);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement