Pseudo Analog touch-pad

Discuss game development design and post your game ideas

Post » Mon Apr 17, 2017 10:00 pm

Hi, i was looking in the forum for a good analog input for touchscreen but they were over complicated or have events that eventually bugs other inputs and layouts so i had this idea that worked fine and wanted to share

It's not a great discover but for newbies like me could save a lot of time.

First draw or get a pad sprite like this

Image

Then cut it in 4 like this

Image

You will get 4 pieces like this

Image

Now give 8dir behavior to your character and create the events

On touch of each image -> simulate respective direction

In the layout use the first image as a mask and then put the rest togheter overlaping.

When you touch each button if you swipe your finger around it, it will work as a analog pad (kind of), it only use 4 events and has fast response to touch.

Hope you it helps someone! (i deleted this post last time because images were not showing, now i'm using imgur if it doesnt work please advice me)
B
14
S
5
G
3
Posts: 22
Reputation: 2,581

Post » Mon Apr 17, 2017 10:05 pm

I forgot, and it seems i can not edit:

You can just do it with a blank image or 4 rectangles, then add an analog pad image with 8 animations and create 8 events to show respective animation when each combination of button is pressed.
B
14
S
5
G
3
Posts: 22
Reputation: 2,581

Post » Fri May 05, 2017 8:38 am

A way to make it analogue easily is to set a center imagepoint and when touching the sprite, use X Y coords relative to the sprite's center to determine control power.
Example:
if touch touching analogue
   xAxis = touch.X - analogue.X / (analogue.Height / 2)
   yAxis = ..........

You can get more complex with deadzones and such as well.

touch.X - analogue.X gives the relative position of touch to analogue. Dividing by 2 gives half the height of the analogue sprite (which you would change to a more reliable value)
B
42
S
14
G
3
Posts: 165
Reputation: 5,115

Post » Fri May 05, 2017 6:47 pm

Sumyjkl wrote:A way to make it analogue easily is to set a center imagepoint and when touching the sprite, use X Y coords relative to the sprite's center to determine control power.
Example:
if touch touching analogue
   xAxis = touch.X - analogue.X / (analogue.Height / 2)
   yAxis = ..........

You can get more complex with deadzones and such as well.

touch.X - analogue.X gives the relative position of touch to analogue. Dividing by 2 gives half the height of the analogue sprite (which you would change to a more reliable value)


I search for this in the forums and many people solved it like this but in-game anda android the analogue usually bugs and ends up requiring extra effort.

Most of people working in a proyect only want to move an object without so much precition but with the idea that you dont leave the touch of the buttons. The first thing you think about is an analog but this way you can solve this movement easily without risk.

The objetive behind this is not touching the "move" buttons once and again, so this is a pseudo analog touch-pad.
B
14
S
5
G
3
Posts: 22
Reputation: 2,581


Return to Game Development, Design & Ideas

Who is online

Users browsing this forum: No registered users and 6 guests