Jump to content


  • Content Count

  • Joined

  • Last visited

  1. By a client's request, I'm supposed to make two phaser games launch from a single html. I decided to do this via the game.js that (our) phaser template spits out because the games trade data between each other. Here's my code for game.js: import GameOneBoot from './states/GameOne/boot'; import GameOnePreload from './states/GameOne/preload'; import GameOneTitle from './states/GameOne/title'; import GameOneGameplay from './states/GameOne/gameplay'; import GameTwoBoot from './states/GameTwo/boot'; // etc, etc... class Game extends Phaser.Game { { constructor() { super(config.gameW
  2. This is my first time integrating any outside source into my phaser project, so please bear with me. Also, if there's anything that's unclear (regarding errors), lemme know so I can update this. For the first question, please check my steps below if I imported them right: Navigate into base project directory in a terminal, type in npm i / install "scroll-plugin-of-your-choice-here" Watch a lot of text scroll by (Mostly warnings) Find the folder in the node_modules directory of my project, copy the required file from the dist folder into my folders (this one is called: plugi
  3. Fixed it. The problem is with this code: this.touchBtnUp = this.game.add.button(160, this.game.world.height - 300, 'ctrlBtn_up', this.touchUpCallback, this, 'btn_up.png'); For some reason, on game restart, the game.world.height changes. So it's less a case of it disappearing than it is getting set up in the wrong place. For now, I just hard-coded in my usual height, until I figure out why that changes.
  4. Exactly as it says on the tin. The buttons in question are on-screen buttons, for mobile devices. Here's my code them. this.touchBtnUp = this.game.add.button(160, this.game.world.height - 300, 'ctrlBtn_up', this.touchUpCallback, this, 'btn_up.png'); this.touchBtnDown = this.game.add.button(160, this.game.world.height - 150, 'ctrlBtn_down', this.touchDownCallback, this, 'btn_down.png'); this.touchBtnLeft = this.game.add.button(20, this.game.world.height - 150, 'ctrlBtn_left', this.touchLeftCallback, this, 'btn_left.png'); this.touchBtnRight = this.game.add.button(300, this.game.world.h
  5. Thank you so much for the reply. I think I see where I failed, and I'm quite embarrassed to say that instead of adding the sprite object itself to the the game group, I've been adding the empty sprite object container. My error is in fact visible in the code above. I've since corrected the code, and re-applied the sort('y', Phaser.Group.SORT_ASCENDING) code back, and took your advice and moved the floor tiles into a group of their own, one that is drawn earlier. So now, I have two groups: Floor Group - This is unsorted, and spawned / drawn earlier than the Player/Object Group. Thi
  6. First off, please take note that I'm not just new to this forum, I'm new to phaser in general. I know a lot of people had z-ordering issues before. I've read about them. And most of the replies amount to "use the built-in sorting system." Which is great... if or when it works. However, I haven't seen anything that approaches my code, so I'm not entirely sure what to do. And boy does it produce some unique issues when the group sort is applied. There is one difference between the samples I see online and my code: I don't use +/-x and +/-y to move my character; instead, I use tween. Th
  • Create New...