• Content Count

  • Joined

  • Last visited

About Sammdahamm

  • Rank

Recent Profile Visitors

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

  1. I feel like there should be a simple answer to this, but I've been unable to uncover anything so far. I've created a tilemap, added a tileset image, and created a static layer. The map renders perfectly, yay. I have "gate" tiles in my game which take the player to another world, by loading in another tilemap. I use the same process, and the map renders correctly again, woo. The problem is that the original static layer was not destroyed, so the new map is imposed on top of the other. I am looking for a way to wipe the scene's tilemap between changing worlds. I have looked for methods such as .reset() on the static layer, and the scene, but I haven't found anything so far. I don't want to fully restart the scene/game each time either, as that seems excessive, and would cause heavy (unnecessary) loading times. I feel that this would be such a common scenario, that I must be missing something really obvious, and I'd appreciate a gentle pointer in the right direction. Thanks in advance Sam
  2. Ah you're totally right! I was wondering where the NaN was coming from I got thrown off a bit due to the moveToObject() method taking a {x: y:} object as the destination parameter, I didn't notice that moveTo() was a bit different haha Been scratching my head on this for while, thanks for the help dude
  3. Hi Guys, so Phaser 2 had a method, game.physics.arcade.moveToPointer() which moved a sprite with a given velocity towards the cursor. It seems like this has been replaced in Phaser 3 by a "moveTo()" method in ArcadePhysics, so I'm trying to reimplement it myself. I create a spriteGroup: this.projectiles ={collideWorldBounds: true}) and then later create & attempt to fire a projectile from within a "fireProjectile" method: this.firePlayerProjectile = function(projectileType){ let projectile = this.projectiles.getFirstDead(true, this.player.sprite.x-16, this.player.sprite.y-32, projectileType); this.scene.physics.moveTo(projectile, {x: this.scene.input.x + this.scene.cameras.main.scrollX, y: this.scene.input.y + this.scene.cameras.main.scrollY}, 750); } This does create the projectile sprite in the correct location, but rather than then travelling towards the target location, it just sorta of flashes and disappears after a second. Can anyone tell what I might be doing wrong? How do I get the projectile to move to a given location (and beyond) at a constant velocity? Thanks, Sam
  4. I've been looking through the Phaser 3 repo and found that SceneManager has a "bringToTop" method, but this only takes a Scene as a parameter. Has "bringToTop" in a sprite/group context been removed in Phaser 3? if so I'd like to request that it is reimplemented as I found this to be really useful in Phaser 2. If it has been removed, can anyone suggest a temporary workaround to bring a sprite group to the top of a view? I'm assuming it'll involve manipulating the group's children's z-indexes but I'm not sure how this would be done relative to other groups in the Scene Nice one thanks, Sam
  5. Hey guys, So I've just started refactoring my codebase to Phaser 3 today and I've hit a few bumps. Nothing too bad so far, but one I can't get my head around is how to bring sprites/sprite groups to the front of the display in Phaser 3. In Phaser 2 we had, but I'm struggling to find the equivalent in Phaser 3. Any help appreciated, nice one thanks. Sam