As of late 2021, we are in the process of updating Stencylpedia and fixing up outdated & broken content. Thanks for your patience!







Mobile Input - Touch & Gestures

by Jon (Updated on 2015-10-14)


  • Introduction
  • Single Touch
  • Multi-Touch
  • Example: Multi-Touch
  • Swiping
  • Example: Swiping


Mobile apps are driven by touching, tapping and other gestures. Stencyl exposes all of these features through a combination of events and blocks.

Single Touch

Using Blocks

Single-touch is handled using the mouse blocks. In other words, treat touch just like using the mouse.


Mouse Action Touch Action
Mouse is Down Touching Screen
Mouse is Down on Actor Touching Actor
X of Mouse X of Touch
Y of Mouse Y of Touch

Using Events

If you prefer to use Events, the analogous Mouse Events do the same thing.



For many games, single-touch is sufficient, but for some games, it’s necessary to support multi-touch. Such games require tracking several fingers on screen moving independently. One very common example of this use case is a game that displays multiple on-screen buttons, such as a platformer.

Stencyl supports multi-touch exclusively through an event.


This event is triggered any time a touch begins, is dragged around or ends. Using the ID of touch block, which maintains the same value throughout the lifecycle of a touch, you can refer to that touch and act accordingly.

Additionally, you'll find that the ID of touch block also lets you get the X/Y positions of that particular touch by selecting those options from its dropdown.


Warning: Do Not Mix Single and Multi-Touch

You must enable multi-touch in Settings > Mobile > User Input to receive multi-touch events. Moreover, when multi-touch is enabled, avoid using single-touch input blocks, for they will act in unexpected ways.

In other words, when multi-touch is enabled, count on using multi-touch blocks all the way through.

Example: Multi-Touch

In this example, the player can move some objects independently of each other using multi-touch.

Tip: Are you just looking to implement virtual, on-screen buttons? Grab the On Screen Button behavior from StencylForge, which uses multi-touch in its implementation.


Swiping is a gesture in which the player presses a finger on screen and drags it in one direction. It is commonly used to scroll through menus or trigger certain actions.


Swipe Event

In Stencyl, the preferred way to detect a swipe is through a Swipe event, accessed via Add Event > Input > Swipe.

swipe-event swipe-event

Swipe Block

If you prefer to use a block to check for this instead, you can find one under User Input > Mobile-Only.


Print Article Edit Article How to Edit an Article
Disclaimer: Use comments to provide feedback and point out issues with the article (typo, wrong info, etc.). If you're seeking help for your game, please ask a question on the forums. Thanks!


I've done 2 tutorials on the MultiTouch Mobile Input Block which might help some people come to grips with the subject. They can be found at:


0 6 years, 4 months ago
IMPORTANT UPDATE NEEDED: The "On Screen Buttons" behavior this article recommends needs to be updated to work with newer versions if Stencyl, otherwise it will crash the game, because the list attribute "Touching IDs" is not initialized as "create new list".

Until that's resolved, what you need to do to make this behavior work is add the following blocks in the 'created' event of the "on Screen Buttons" behavior:

Set [Touching IDs] to [create new list]

The "create new list" block is under attributes ---> lists in the pallete.

0 6 years, 5 months ago
dose anyone know where i can learn to do multi touch so i can run and jump at the same time on mobile?
2 8 years, 6 months ago
@yoplalala it's not recommended and may cause PROBLEMS but yes, you can mix single touch and multi touch
0 8 years, 8 months ago
"In other words, when multi-touch is enabled, count on using multi-touch blocks all the way through."

can we use single touchs in some scenes and multi-touche in some other scenes ?

0 8 years, 8 months ago
my touch sreen function doesnt work even though i used the universal mouse click really stumped on what to do. help! thanks!
0 9 years, 10 months ago
Don't understand the multi touch part one bit, the explanation is very vague. Help!
2 10 years, 1 month ago
Download demo for multi-touch is not available. Directs me to a blank page...
0 10 years, 3 months ago
This is amazing!!!!
-1 10 years, 4 months ago

Sign In to Comment