#### Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

# Finger control for mobile apps

Posts: 86Member, PRO

I saw from the examples how to make movement controls using the keyboard, but how do we let the user use their finger to control movement? Can I get an example? Thanks.

• Posts: 11,313Member, Sous Chef, PRO, Senior Sous-Chef

You'll need to describe the type of finger movement and actor movement you're interested in. There are so many possible ways to implement this that it's hard to know what you're looking for.

New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

• Posts: 86Member, PRO

I have an actor on the left side of the horizontal screen which will be firing bullets to the right.... The actor is constrained in its x coordinate, but the user needs to be able to move him up and down using their thumb... Hope this is clear.

• Posts: 436Member, BASIC

Hello!

The easiest way is to constrain the Actor's Y position to the Y position of the Touch1.Y Position attribute (Located in Device Tab).

This will make the actor always be the same Y position as the touch.

Or,

You can create a Real Attribute for the actor. Call it Y POS.
Lets Create another Real Attribute and call it Y Touch

Add a rule to the actor.
When Touch.Count /= 0
then:

Change Self.Y POS attribute to the actor's current Y position Attribute. (Using the Change Attribute behaviour)

Change Self.Y Touch attribute to Touch1.Y Position attribute (Located in Device Tab).(Using the Change Attirbute behaviour)

Then:

Constrain the Actors Y position to the following: Self.Y POS +(Touch1.Y Position - Self.Y Touch)

This will only move the actor up or down relative to the distance that the player moves their finger.

Hope they help get you started!

Best,
Two.E