• Content Count

  • Joined

  • Last visited

About MTiger

  • Rank

Recent Profile Visitors

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

  1. I solve my problem in the short term by rapping the statements in a setImmediate statement so they get placed in the event loop and the method can complete setImmediate(() => this.startGame());
  2. In my game the player will create a character (TODO), then start the game. The game starts by placing one tile on the board Right now I just have a GameController which is a phaser Scene In the Game Controller I want to have instances to the board and the UI Menu so that I can communicate with the other scenes throughout the game The issue that I am currently having (and I think that it is because of JS single threaded nature) is that I need to wait for the Board's create method is complete before I can start calling the other methods, but does not start until Game.create is done (and I tried Game.preload) So the question is there a way to wait / detect until is finished? I know that there are certain events that a scene triggers but can I hook into another objects events like on('Board:transitioncomplete',()=>) Is there a cleaner way to structure the order of these events? create() { this.board = this.scene.get('Board'); this.board = this.scene.get('UI');'Board'); this.startGame(); } startGame() { this.board.createRoom(0, 0, 'N'); // this.UI.renderMessage({ message: 'Welcome to the dungeon', parameters: 'Param1' }, (param) => console.log(`Hello from Game with ${param}`)); }
  3. I'm trying to build an '90s style rpg game, think dragon warrior series, where it will have a UI box at the bottom of the screen where the user makes a choice like attack, move, eat etc I'm thinking of having a game controller (phaser scene?) which updates a board scene and a UI box scene and displays other scenes if necessary I am thinking of passing in to the UI box an object with message, an array of choices and each choice will have a callback method So as far as I can tell there are three ways to pass event information to a scene 1) use get scene method to get an instance of a scene and then make calls to that scenes methods 2) using event emitter 3) stopping and starting a scene and passing parameters into the create method Is one way preferable or another? is there a good coding standard? Would anyone be able to offer any other helpful hints on how to accomplish the above task Thank you
  4. Just fyi -- changing the pivot back to 0,0 fixed it -- so I guess I don't know what pivot is
  5. I am trying to create a board that spins if I add everything to worldGroup this works create: function () {,0,1200,1200); ... this.worldgroup =; this.worldgroup.pivot.x =; this.worldgroup.pivot.y =; this.worldgroup.x = this.worldgroup.pivot.x; this.worldgroup.y = this.worldgroup.pivot.y; ... } rotateRoom: function() { ... this.worldgroup.rotation += Math.PI/2; ... }, What I do not understand is this line, my understanding of the documents is that group.create places the sprite x, y, relative to the group so I would expect the sprite to be at 600, 600 but it is placed at 0, 0 in the world addRoom: function() { let tile = this.worldgroup.create(0,0, 'rooms',,9)); tile.anchor.setTo(0.5); }, even if I create the sprite then add it to the group like let tile = new Phaser.Sprite(, 0,0, 'rooms',,9)); this.worldgroup.add(tile); What is weird is that if I move worldgroup x/y after the fact the sprite moves relative, like this.worldGroup.x +=300 What am I missing, how can I place my sprites relative to the center of the world without always adding and subtracting world.centerX, centerY
  6. Isn't as easy as creating a group and let Phaser keep track of the alive state of your group? this.currentPlatform = this.platformPool.getFirstDead(); if (!this.currentPlatform) { this.currentPlatform = new MrHop.Platform(, nextPlatformData.numTiles, + nextPlatformData.separation, nextPlatformData.y, this.levelSpeed, this.floorPool, this.coinsPool); } else { this.currentPlatform.prepare(nextPlatformData.numTiles, + nextPlatformData.separation, nextPlatformData.y, this.levelSpeed); } this.platformPool.add(this.currentPlatform);,js,output
  7. It only happens like once out of twenty times. Do you think increasing the Tile_bais would help?
  8. This might be related, came across this yesterday. Basically thicken up the tiles game.physics.arcade.TILE_BIAS
  9. so you can either put at the top of your file /*global Phaser*/ to subdue the error or you can even do var Phaser = Phaser || {} and that should pick up the initial object if already defined.
  10. I was working with a popular online tutorial in making an infinite runner game. All goes well, except there seems to be this one instance that pushed the player off the screen. (keeping player at velocity 0 instead of -platformSpeed). I think the issue is with this line this.player.body.velocity.x = this.player.body.touching.down ? -this.levelSpeed: 0; It seems to happen when the player catches the very corner of the platform, and isdown does not get set, then the player is "pushed" onto the platform. But this is just a logical guess as it happens too fast to debug. The collision check happens in a line above this.platformPool.forEachAlive(function (platform, index) {, platform); if (platform.length && platform.children[platform.length - 1].right < 0) { platform.kill(); } }, this); My full code is here, but I can't figure a way to get the assets to load,js,output (updated link with Hosted Assets)