Making an easy touchpad

1

Attached Files

The following files have been attached to this tutorial:

.capx

Stats

3,388 visits, 4,990 views

Tools

Translations

This tutorial hasn't been translated.

License

This tutorial is licensed under CC BY 4.0. Please refer to the license text if you wish to reuse, share or remix the content contained within this tutorial.

Published on 19 Jul, 2014. Last updated 19 Feb, 2019

Greetings,

I was trying to make a touchpad and found a tutorial about it, but it was too hard for me, so i tried to make one on my own and i finally made a working one.

Getting Started

Create new project, and name it whatever you want.

First, insert your sprites.

One player, a pad and a big pad for pad's distance limit. Also add an invisible sprite. That will be our compass. Also add touch object.

Set the pad, big pad and compass' position to 119, 367. Add a player and add player "8 direction" behaviour.

Events

First, add the following event:

System -> every tick -> compass -> set angle toward position -> pad.x,pad.y

so whenever we move our pad, compass will turn toward it.

Then add:

Touch -> any touch end -> pad -> set position to (119, 367)

so when you release your pad, it will turn back its original position.

Touch -> is touching object -> bigpad -> pad -> set position -> touch.x , touch.y

so the pad will follow your touch while in bigpad.

8 Direction Simulations

I figured out the relation between compass' angle and player's movement by just trying.

pad.X ≠ 119 because compass has an angle with it's own, so the player could move without you use the pad. when you use the pad, pad.x wont be 119.

That's all, your touchpad is ready! Also there is a capx file, if there is something you can't make, just check it out.

.CAPX
  • 0 Comments

Want to leave a comment? Login or Register an account!