Jump to content

Keep moving after swipe


Recommended Posts


I want the player to initiate movement to left or right after a swipe. This movement should continue until the next time the screen is touched.

I need quite specific information on how to implement this because although Phaser is easy to learn and documentation is good, I seem to be a slow learner and have not been able to make use of several forum entries and even tutorials on this topic. This is why I chose to use the swipe.js plug-in by flogvit (https://github.com/flogvit/phaser-swipe).

Using this plug-in, I am only able to either "teleport" the player to the end coordinates instantaneously or - when I set player velocity - move it an all too tiny bit into the desired direction.

I tried to have a tween executed but this didn't work out - is my command wrong or did I place it badly - or both?

     case this.swipe.DIRECTION_LEFT: game.add.tween(player).to({player.body.x: 50}, 500, Phaser.Easing.Linear.None, true);)

I am absolutely fine with using neither tween nor the plug-in. Any specific (I need to see actual code) help is greatly appreciated.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...