0

I am making a game for mobile devices with Phaser 3. I am stuck at implementing swipe mechanism. I want to swipe my character in any direction the user wants to. I also thought about doing it with hammer.js but couldn't incorporate it with Phaser. If you can integrate hammer.js with Phaser please enlighten me. I found some tuts online.

GameDev forum

Touch events

Sokoban game

Hammer.js and Phaser

2048 with Phaser

Phaser labs

3
  • 1
    On pointer down save X/Y coordinates, on release check current X/Y - saved X/Y, move character (maybe add velocity) based on delta.
    – XCS
    Commented Apr 21, 2019 at 18:15
  • 1
    You should use tweens for that and swipe your sprite with inputs handlers because sure that you can add HammerJS as Phaser is a framework that uses a canvas to display its Game Objects, but you can try to play with HammerJS for example with a global variable and see what happens, sorry I don't have an example right now to let you see that Commented May 1, 2019 at 0:55
  • If you want something light, you can get all the information you need from the pointer in the pointer up event. photonstorm.github.io/phaser3-docs/Phaser.Input.Pointer.html Commented May 4, 2020 at 21:45

0