Sammdahamm

Members
  • Content Count

    5
  • Joined

  • Last visited

About Sammdahamm

  • Rank
    Newbie

Recent Profile Visitors

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

  1. Sammdahamm

    Trying to implement "moveToPointer"

    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
  2. Sammdahamm

    Trying to implement "moveToPointer"

    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 = this.physics.add.group({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
  3. Sammdahamm

    How do you bring sprites/groups to front with Phaser 3?

    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
  4. 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 game.world.bringToTop(group), but I'm struggling to find the equivalent in Phaser 3. Any help appreciated, nice one thanks. Sam