Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function update() {
- // This depends upon pointerOrigin (Phaser.Point) being defined. You'll also need to update 'player' to match your specific needs.
- if (this.game.input.activePointer.isDown) {
- if (this.pointerOrigin) {
- this.player.position.x += this.game.input.activePointer.position.x - this.pointerOrigin.x;
- this.player.position.y += this.game.input.activePointer.position.y - this.pointerOrigin.y;
- }
- // Keep track of where the pointer has been so we can use it for the next update cycle.
- this.pointerOrigin = this.game.input.activePointer.position.clone();
- }
- else {
- this.pointerOrigin = null;
- }
- }
Add Comment
Please, Sign In to add comment