• Content Count

  • Joined

  • Last visited

About Hysteria

  • Rank

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Hysteria

    Working with game pauseEvent

    Thank you so much samme for the answer, that worked!
  2. Hysteria

    Working with game pauseEvent

    Just to clarify, I want to execute a function when the browser changes tabs and forces the game to pause. Can I do this with Phaser 3?
  3. Hysteria

    Working with game pauseEvent

    Hi there, I can't find any documentation that explains how I can handle the game pauseEvent (as described here https://photonstorm.github.io/phaser3-docs/Phaser.Game.html) I want to run a function just before the game enters a Pause state. How can I accomplish this? Thanks~
  4. Hysteria

    Trouble changing Scenes in Phaser 3

    Thanks rich, that did the trick! The issue was that I thought the parameter "this.scene.start();" needed was the Phaser.Scene class, but it was the key for the Phaser.Scene class. Everything works like a charm now ~
  5. Hysteria

    Trouble changing Scenes in Phaser 3

    I still have no idea why the black screen keeps on showing and the second scene doesn't load properly. Any help would be appreciated. 😃
  6. Hysteria

    Trouble changing Scenes in Phaser 3

    Thanks for the quick answer samme! Now the scene actually changes, but the preload function for the new scene doesn't seem to be loading, and I'm stuck with a black screen. var SceneMainGame = new Phaser.Class({ Extends: Phaser.Scene, initialize: function sceneMainGame () { Phaser.Scene.call(this, { key: 'sceneMainGame' }); }, preload: function () { // ... console.log("This is never displayed!"); this.load.image('imgBackground', 'img/background.png'); // ... }, create: function () { // ... console.log("This is never displayed either!"); this.add.image(480, 320, 'imgBackground'); // ... } }); Edit 1: I forgot to had that the console doesn't display any error messages. Edit 2: I've tried to change the order of the scenes and the MainGame scene loads just fine, which indicates that the error source it's something to do with the scene transition.
  7. Hi there fellow coders! I'm in the making of a new game and I've run into some issues while trying to implement multiple scenes. When I run the following code I get the error " TypeError: this.scene.start is not a function ". var SceneMainMenu = new Phaser.Class({ Extends: Phaser.Scene, initialize: function SceneMainMenu () { Phaser.Scene.call(this, { key: 'sceneMainMenu' }); }, preload: function () { this.load.image('imgButtonStartNormal', 'img/button-start-normal.png'); this.load.image('imgButtonStartHover', 'img/button-start-hover.png'); this.load.image('imgButtonStartClicked', 'img/button-start-clicked.png'); }, create: function () { this.add.text(75, 170, 'Coffee Island', { fontSize: '100px', color: '#0000FF' }); // Start Button btnStart = this.add.sprite(790, 160, 'imgButtonStartNormal').setInteractive(); btnStart.setDisplaySize(32,32); btnStart.on('pointerover', function (event) { btnStart.setTexture('imgButtonStartHover');/* Do something when the mouse enters */ }); btnStart.on('pointerout', function (event) { btnStart.setTexture('imgButtonStartNormal');/* Do something when the mouse exits. */ }); btnStart.on('pointerdown', function(event){ btnStart.setTexture('imgButtonStartClicked'); this.scene.start(SceneMainGame);}); // Start the main game. } }); I believe the cause is that "this" in this context is a reference to the sprite, not the actual scene, but I''ve also tried to do something like "SceneMainMenu.scene.start(SceneMainGame); and it doesn't work either. Any sort of help will be appreciated. Thanks!~