• Content Count

  • Joined

  • Last visited

  1. That makes sense! So I separated out the preload portion into its own scene called LoadScene.js but I'm a little confused on the order. So I have my LoadScene.js, where I preload all the things I need for the game. In the create section, I create those keys. Now how do I use those newly created keys and assets inside my other two files, MenuScene (which should get called next) and GameScene (the main scene)? I tried importing LoadScene into MenuScene and GameScene, but it's obviously breaking hard.
  2. Hi, I have a simple Phaser 3 game with a MenuScene and a GameScene. MenuScene loads, player hits the enter key, then GameScene loads. Once you die in GameScene, I have it go back to the MenuScene, but when you press enter to start again, I get this error: Invalid Animation Key, or Key already in use: right for right, left, and turn. I found a thread that mentions something about preloading assets in the MenuScene which I tried, but it did not alter the issue at all. Just for simplicity, I've cut out the small pieces relating to this, any ideas on why it's not loading after you restart the game would be greatly appreciated, thanks! MenuScene create() { this.key = this.input.keyboard.addKeys({ 'Enter': Phaser.Input.Keyboard.KeyCodes.ENTER }); } update() { if (this.key.Enter.isDown) { this.startGame(); } } startGame() { this.scene.start('GameScene'); } GameScene update() { if (this.gameOver){ this.scene.stop('GameScene'); this.scene.launch('MenuScene'); } }
  3. This worked like a charm!!! Thank you so much! I hadn't seen the tweens thing until this, so that was super helpful. Thank you thank you!
  4. Hi, I've been stumped by this for quite awhile and I feel as if it's so simple. I'm simply trying to create a platform that moves back and forth that a player can jump on. I got a platform to move by doing something like this: platform = this.physics.add.sprite(300, 100, 'form'); platform.body.allowGravity = false; platform.body.immovable = true; platform.body.velocity.x = 100; But it just keeps moving in one direction and I can't figure out how to make it collide with the player. I tried the: this.physics.add.collider(this.player, platform); But that did not work. I just want a simple platform that moves back and forth that the player can jump on. Please any help is greatly appreciated, I'm ready to pull my hair out over this. 😞