Moving a player around the screen happens in most games, and while you can use D-Pads and other onscreen controls, why not take advantage of the touch screen instead of trying to recreate an analog joystick?
Swipe the screen to move your player!
This mini-tutorial includes a swipe function that can be used over and over again in all your games. It’s easy to implement and I’ll show you how to use it to move your character two different ways:
- Using transition.to()
- Using setLinearVelocity() with Physics
The physics-based demo is actually the foundation of a Space Invaders-type game that you can polish up and even publish, if you like!
In any case, this tutorial will walk you step-by-step through using the swipe function, but even more importantly, it will explain the code so you’ll be able to enhance it, make tweaks, etc.
If you’ve ever wanted to allow users to swipe the screen and move the player character, puzzle pieces, etc., this mini-tutorial is for you! This same code is being used in published games right now, and you can start using it in your own games in just minutes!
With just two functions you’ll receive messages of left, right, up, down, and none, depending on how the user swipes the touch screen. Now that you know how they’re swiping, you can move your sprites on the device!
- the swipe function
- sample code (including the base game)
- 24/7 access to the tutorial videos
$10, immediately after buying. WAIT! Launch special means you can get the whole thing for just $5 right now, but this is a limited time price, so get it now!
PS – Did you buy the $77 package from me? If so, you get this mini-course for free. Check your Member Dashboard and see if it’s there. If not, use the contact form to let me know (please include the transaction ID from your PayPal payment).