‘TOUCH’ CONTROLS: ADDING SPECIFIC CONTROLS

Look at some of the ‘Touch’ controls.

Let’s create a simple app here.

I resize the layout.

In this beautiful one-page application.

Add ‘Sprite’

We make this ‘Player’ 32 x 32.

It doesn’t matter what color it is. Choose a color.

We call this ‘Player’

Let’s get started.

Now we have a ‘Player’ here.

Let’s make one item here.

It seems like ‘Origin’ has not been established yet.

We made this 16 x 16.

Make sure that ‘Origin’ is there.

Perfect!

We have a ‘Player’ here. Add ‘Touch’

It will allow us to do everything with just one touch. Let’s start here.

There are many items that you can do by touch.

The first thing I like to do is ‘Is touching object’

If you are touching ‘Player’

Let’s set ‘Opacity’ to 25.

Get started.

The tool is quite simple.

Not too complicated! Now there are other things that you can technically do the same thing.

‘On tap object’ you will see that this is roughly the same.

You might think it’s the same but ‘Is touching object’ is a bit different.

I changed it back.

Therefore if I touch and move it over, you can see that it does change. I copy this and select ‘Invert’

See this.

I move it in.

Move it out.

I touch it.

If I move my finger in, it will change. That’s a common thing to do with ‘Touch’ controls. There are numerous different items you can do.

One of the most interesting items you can do with the ‘Touch’ controls.

If you want to set the player to ‘Touch’ controls, there are two ways to do it. One way is to click ‘Is in touch’

We’ll set the player to ‘Touch.X’ then ‘Touch.Y’

Let’s see how it works here.

I touch it.

As you can see, I move it around, but if I don’t touch it won’t move. Go ahead and play around with this.

Let’s say you only want to set one of the positions.

We can put the ‘Touch.X’ and ‘Player.Y’

It’s only set the touch of the X so I can move it up and down as much as I want, but it’s only going to move side to side.

It’s essential for space shooters. You can see I can move to the left-right but can’t go up and down. I can also set it another way, ‘Player.X’ and ‘Touch.Y’

This will move it up and down.

The tool is quite simple. Let’s see what we have here.

We have various options here. There is acceleration that involves gestures and swipes, but I don’t use any of them.

However, I will talk about ‘AbsoluteX’ and ‘AbsoluteY’

You need to know what all this is to make a good game and make a lot of money on the App Store. Sometimes I use ‘Touchindex’ and ‘TouchID’

If I need to count I.D. and index that I’m working on, but I don’t use it very much because even if you know how to do complex stuff in code, you should always simplify it. Anyhow, let’s go back to ‘AbsoluteX’ and ‘AbsoluteY’

If you don’t know what absolute means, it’s a positive number. Change this to ‘AbsoluteX’ and see what happens.

You can see that it works fine, but as soon as I move it, it moves there too. Let’s put ‘Touch.AbsoluteY’ here and consider that.

We can move it up and down here. What’s interesting about this is that it’s supposed to have a positive value, and technically the player is at a negative value at this point. Therefore, if you want to get ‘AbsoluteX’, you must set it with an absolute function.

You enter ‘abs (Touch.X)’ and ‘abs (Touch.Y)’

It will give us the expected effect we are searching for.

It moves because, technically, it is at a negative value.

I can move it off the screen here. It can only be done this way on the computer.

If you have a mobile device, it’s hard to do that.

It doesn’t move off the screen to the right, and the bottom is that on both sides, it stays positive.

If I move the mouse to the top left corner, the touch coordinate is technically a negative value, and it moves the mouse on the screen.

In the next section, we will talk over more ‘Touch’ controls.