Mohammed Salman Posted September 26, 2017 Share Posted September 26, 2017 I have been looking for a solution for a while now! the idea is to move the zombies to the point i hold the mouse in and stop when i release the mouse, this is my movement code: //check mouse down if (game.input.mousePointer.isDown) { //move all zombies zombies.forEach(function(zombie) { game.physics.arcade.moveToPointer(zombie, 400); //if in box reset velocity if ( Phaser.Rectangle.contains( zombie.body, game.input.x, game.input.y ) ) { zombie.body.velocity.setTo(0, 0); } //end if }, this); //end forEach } else { zombies.forEach(function(zombie) { zombie.body.velocity.setTo(0, 0); }, this); //end forEach } //end else if (game.time.now > nextFire) { fire(); } basically what i want is to check for the same input in mobile devices, i have tried using: game.input.onDown.add(move , this); but it didn't work well for me because the zombies kept on going on that direction forever. please help:( this is the full code: http://github.com/msal4.github.io/increment/ Link to comment Share on other sites More sharing options...
samme Posted September 26, 2017 Share Posted September 26, 2017 Think you can use game.input.activePointer.isDown. Mohammed Salman 1 Link to comment Share on other sites More sharing options...
Mohammed Salman Posted September 27, 2017 Author Share Posted September 27, 2017 it worked thanks:) Link to comment Share on other sites More sharing options...
Recommended Posts