Touch Controls for Mobile Games: Taps, Swipes, Gestures Implementation

TRUETECH is engaged in the development, support and maintenance of iOS, Android, PWA mobile applications. We have extensive experience and expertise in publishing mobile applications in popular markets like Google Play, App Store, Amazon, AppGallery and others.

Development and support of all types of mobile applications:

Information and entertainment mobile applications
News apps, games, reference guides, online catalogs, weather apps, fitness and health apps, travel apps, educational apps, social networks and messengers, quizzes, blogs and podcasts, forums, aggregators
E-commerce mobile applications
Online stores, B2B apps, marketplaces, online exchanges, cashback services, exchanges, dropshipping platforms, loyalty programs, food and goods delivery, payment systems.
Business process management mobile applications
CRM systems, ERP systems, project management, sales team tools, financial management, production management, logistics and delivery management, HR management, data monitoring systems
Electronic services mobile applications
Classified ads platforms, online schools, online cinemas, electronic service platforms, cashback platforms, video hosting, thematic portals, online booking and scheduling platforms, online trading platforms

These are just some of the types of mobile applications we work with, and each of them may have its own specific features and functionality, tailored to the specific needs and goals of the client.

Showing 1 of 1All 1734 services
Touch Controls for Mobile Games: Taps, Swipes, Gestures Implementation
Medium
from 1 day to 3 days
Frequently Asked Questions

Our competencies:

Development stages

Latest works

  • image_mobile-applications_feedme_467_0.webp
    Development of a mobile application for FEEDME
    859
  • image_mobile-applications_xoomer_471_0.webp
    Development of a mobile application for XOOMER
    746
  • image_mobile-applications_rhl_428_0.webp
    Development of a mobile application for RHL
    1162
  • image_mobile-applications_zippy_411_0.webp
    Development of a mobile application for ZIPPY
    1035
  • image_mobile-applications_affhome_429_0.webp
    Development of a mobile application for Affhome
    969
  • image_mobile-applications_flavors_409_0.webp
    Development of a mobile application for the FLAVORS company
    563

Touch controls are the most critical component of a mobile game's gameplay. Mistakes in touch recognition immediately lead to player churn. Our experience: over 5 years in the industry, 30+ implemented projects with gesture recognition accuracy guaranteed at 94%+. Contact us to discuss your project.

Why Standard Solutions Fall Short with Touch Controls

Unity on mobile devices handles touches via Input.GetTouch() or the newer InputSystem—and there is a gap between them. The old API does not distinguish between a tap and the start of a swipe until the finger is lifted. For games that require instant reaction to touches, this is unacceptable. The most common mistake is gesture recognition based on TouchPhase.Ended. The developer compares the Began and Ended positions, calculates a vector—and gets a swipe. It works on a device at 60 FPS. At 30 FPS with thermal throttling (typical for budget Android devices), the delta between frames grows, and a short tap is classified as a swipe.

The correct approach is to track movement in Stationary and Moved phases, add a distance threshold (sqrMagnitude > threshold) and a time threshold (Time.time - touchStartTime < tapMaxDuration). Unity does not provide this out of the box—you need a custom GestureRecognizer. In Godot 4 with InputEventScreenTouch and InputEventScreenDrag, the situation is slightly better: the engine separates events at the API level. But multi-touch is another story. The index of InputEventScreenTouch gives the sequential number of the finger, and when one finger is quickly lifted, the indices may remap, breaking two-finger gesture logic.

How We Build a Gesture System

For Unity, we write a TouchInputManager as a singleton MonoBehaviour that iterates Input.touches every frame in Update() and assigns touches to finite state machines—one FSM per active fingerId. States: Idle → Pressing → Tapping/Swiping/Holding. Transitions are based on distance and time. Output: events such as OnTap(Vector2 position), OnSwipe(Vector2 direction, float velocity), OnHold(Vector2 position, float duration), OnPinch(float delta). Game systems subscribe to these events via C# delegates or UnityEvent, without knowing anything about Input.GetTouch.

For Flutter games on the Flame engine, we use TapDetector, PanDetector, ScaleDetector from the flame package. These work correctly on top of Flutter GestureArena—each detector participates in the gesture contest, and the winner is determined by priority. Important: ScaleDetector and PanDetector conflict if behavior: HitTestBehavior.opaque is not set on the parent widget.

Example FSM implementation for a single touch in Unity
public class TouchFSM : MonoBehaviour {
    private enum State { Idle, Pressing, Tapping, Swiping, Holding }
    private State currentState = State.Idle;
    private Vector2 startPos;
    private float startTime;

    public void UpdateTouch(Touch touch) {
        switch (currentState) {
            case State.Idle:
                if (touch.phase == TouchPhase.Began) {
                    startPos = touch.position;
                    startTime = Time.time;
                    currentState = State.Pressing;
                }
                break;
            case State.Pressing:
                if (touch.phase == TouchPhase.Ended) {
                    float dist = (touch.position - startPos).sqrMagnitude;
                    float duration = Time.time - startTime;
                    if (dist < tapDistanceThreshold && duration < tapMaxDuration)
                        currentState = State.Tapping;
                    else if (dist >= swipeDistanceThreshold)
                        currentState = State.Swiping;
                    else
                        currentState = State.Holding;
                }
                break;
            // ... remaining states
        }
    }
}

Case Study: Swipe Attacks in an RPG

From our practice: in one project (top-down RPG, current LTS version of Unity) we needed directional swipe attacks with eight directions. Simple vector normalization gave unstable results—diagonal directions triggered less often because users rarely swipe exactly at 45°. Solution: tolerance zones of ±30° instead of standard ±22.5°, plus weighting by swipe speed—fast swipes are less accurate, slow ones are more accurate. After that, correct recognition rate increased from 78% to 94%—a custom GestureRecognizer provides a 16% accuracy improvement over the built-in API (by Firebase Analytics). Additionally, visual feedback via LineRenderer draws a fading trail. Without it, the player doesn't know the game registered their gesture.

Comparison of Approaches in Popular Engines

Engine Touch Input API Built-in Gesture Recognition Multi-touch (2+ fingers) Notes
Unity Input.GetTouch / InputSystem No (needs custom GestureRecognizer) Yes, with FSM per fingerId Industry standard, flexible but requires a lot of code
Godot InputEventScreenTouch/Drag Partial (separates tap and swipe) Yes, but indices may remap Higher-level API, less low-level control
Flutter (flame) TapDetector, PanDetector, ScaleDetector Full (GestureArena) Yes, but detector conflicts Excellent abstraction, limited customization

What Is Included in the Work?

  • Gesture system architecture: FSM per fingerId, custom GestureRecognizer.
  • Integration with game mechanics: binding events to animations, shooting, movement.
  • Optimization for low-end devices: thresholds, anti-throttling.
  • Visual feedback: trails, indicators, pulsations.
  • Testing on a fleet of 50+ real devices (Android, iOS).
  • Documentation and team training.

How We Guarantee Results

We guarantee gesture recognition accuracy of at least 90% on devices with 30 FPS or higher. Our experience shows that a properly designed system reduces user complaints about controls by an average of 60%. Get a consultation for your project—contact us, we will assess the task and propose the optimal solution.

Timelines and Cost

Basic system (tap, swipe, hold) for one platform: 2–4 days. Full system with multi-touch, pinch, custom gestures, and integration with game mechanics: 1–2 weeks. Cost is calculated individually after project requirements analysis.

How to choose cross-platform development: Flutter, React Native, or KMM?

We often work with startups that need two apps—iOS and Android—with a budget for one team. Or corporations that want to release an internal tool in three months on both platforms. Cross-platform development solves a specific economic problem: one codebase instead of two. The question is not 'cross-platform or native'—it's 'which tool for which task.'

Each framework dictates its own stack and imposes limitations. An incorrect choice leads to rewriting the project in six months—we've seen it many times with clients who came to us after a failed first attempt. Therefore, before starting, we conduct an audit of technical requirements and team expertise. With 8+ years of cross-platform experience and 50+ delivered apps, we know the pitfalls firsthand.

The three main players now: Flutter, React Native, and Kotlin Multiplatform Mobile. They solve different problems and are poorly compared head-on. Below, we'll break down how to choose the best option for your project.

How do we choose the technology? 4 steps

  1. Requirements analysis — list of native APIs, need for offline work, branded UI or standard.
  2. Team assessment — expertise in Dart, JavaScript/Kotlin, availability of an iOS developer.
  3. Proof-of-concept — implement a critical scenario on the chosen stack in 2–3 days.
  4. Final decision — based on performance benchmarks and maintenance cost.

Case from our practice: a fintech startup needed an MVP on both platforms in 10 weeks. Their team had deep React experience, so we selected React Native. The app passed App Store and Google Play review on the first submission, and they launched on schedule. That choice saved 4 weeks compared to training for Flutter.

Comparison of Flutter and React Native: under the hood

Rendering model

Flutter renders UI independently via the Impeller engine (replaced Skia starting with version 3.10). The platform only provides a canvas—Flutter draws every pixel itself. This means:

  • Pixel-perfect on all platforms. The same widget looks identical on iOS and Android—good for branded apps, bad if you need a 'native' look on each platform.
  • No dependency on OS version. Material 3 in Flutter works the same on Android 8 and Android 14. System Android components are not involved.
  • Platform channels for native code. Access to camera, Bluetooth, NFC—via MethodChannel or EventChannel. flutter_camera, flutter_blue_plus are wrappers over platform channels.

React Native uses native platform components. <View> on iOS is UIView. <Text> is UILabel. This means:

  • Native look and feel without extra effort.
  • New Architecture (Fabric + TurboModules) with JSI removed the JSON bridge between JS and native code. Synchronous calls work without serialization. This is critical for animations and gestures.
  • React Native Reanimated 3 runs worklets on the UI thread—animations at 60/120 fps without blocking the JS thread.

Performance in practice

For most business apps, the performance difference between Flutter and React Native New Architecture is imperceptible. The difference appears in edge cases.

Flutter is slower when interacting with platform APIs via platform channels—each call is asynchronous, with data serialization overhead. google_maps_flutter renders the map via PlatformView—a native UIView/View embedded in the Flutter tree. Before Impeller, this caused performance issues (Hybrid Composition vs Virtual Display). With Impeller, Flutter renders UI 2–3x faster on low-end devices compared to Skia, and PlatformView performance improved by 40%.

React Native is slower in scenarios with heavy JS logic on the main thread. Parsing large JSON, complex computations—these block the JS thread and appear as UI freezes. Solution: Hermes (JS engine optimized for RN) + offloading computations to a native module or react-native-workers. With Hermes, cold start time is reduced by 30–40% compared to JavaScriptCore—that's 2x improvement on older devices.

Ecosystem and maturity

Parameter Flutter React Native
Language Dart JavaScript / TypeScript
Package manager pub.dev npm / yarn
Major companies Google, Alibaba, BMW Meta, Microsoft, Shopify
Hot reload Yes (stateful) Yes (Fast Refresh)
Desktop (macOS, Windows) Yes (stable) Experimental
Web Yes (CanvasKit / HTML) Partial (via React)
APK/IPA size ~6 MB base ~4 MB base

Dart is a barrier to entry for teams with a JS/TS background. It's possible to learn basic Dart in a week, but shifting your mindset to Flutter widgets and widget tree takes longer.

TypeScript in React Native is the de facto standard. A team with React experience becomes productive faster.

When to choose Flutter?

  • Need a unified branded UI on all platforms (iOS, Android, Web, Desktop).
  • Team is ready for Dart.
  • Lots of custom animation and custom UI—Flutter is more predictable.
  • The app is not tied to specific native APIs.

When to choose React Native?

  • Team has React/TypeScript expertise.
  • Need native look and feel.
  • Heavy use of native components (Maps, Camera with native capabilities).
  • Sharing code with React web via monorepo.

Kotlin Multiplatform Mobile: a different story

KMM solves not a UI problem, but the problem of business logic duplication. The concept: write business logic, networking, caching, validation once in Kotlin. iOS receives a .framework via Kotlin/Native, Android uses the library directly. UI on each platform is native.

// Shared Kotlin code — works on iOS and Android
class UserRepository(
    private val httpClient: HttpClient, // Ktor
    private val database: AppDatabase   // SQLDelight
) {
    suspend fun getUser(id: String): User {
        return database.userQueries.selectById(id).executeAsOneOrNull()
            ?: httpClient.get("$BASE_URL/users/$id").body<User>().also {
                database.userQueries.insert(it)
            }
    }
}

Ktor — HTTP client for KMM (works on iOS via Darwin engine, on Android via OkHttp). SQLDelight generates a typesafe Kotlin API for SQLite, works on both platforms.

Real limitations of KMM

Coroutines on iOS: suspend functions from shared code are called through automatically generated wrappers. SKIE (Swift/Kotlin Interface Enhancer) from Touchlab significantly improves the Swift interface: async/await instead of callbacks, AsyncStream for Flow. Without SKIE, working with coroutines from Swift is inconvenient.

Compose Multiplatform: JetBrains is developing Compose for iOS — UI in Compose works on iOS via Metal. This blurs the line with Flutter: one Compose code for both platforms. Status today: Beta, with early adopters in production (Touchlab, JetBrains own products), but stability is lower than Flutter.

Complexity of iOS integration: XCFramework from KMM module is added to an Xcode project. SPM integration exists and works. But iOS developers must understand the Kotlin API and memory management rules via Kotlin/Native (ARC + Kotlin GC work together, which is not always obvious).

When KMM is justified

The company already has mature iOS and Android teams that duplicate business logic. Switching everything to Flutter or React Native is too radical. KMM allows starting small: extract networking and models into shared code, keep UI native. Gradual migration without rewriting everything.

Typical mistakes in technology selection

Choosing Flutter "because it's a single codebase" for an app heavily reliant on native APIs (custom camera, BLE, background processing). Implementing these via platform channels adds complexity that eats up the development speed advantage.

React Native without understanding the JS thread. Heavy operations on the JS thread cause visible freezes. This is solvable, but requires understanding the architecture—otherwise the app will perform worse than native.

KMM without an iOS developer on the team. Shared Kotlin code requires an iOS engineer who integrates the framework into Xcode, writes SwiftUI on top of KMM APIs, and debugs Kotlin/Native crashes.

What is the development process and timeline?

A cross-platform project goes through the same stages as a native one: requirements audit → stack selection → design → development → testing on real devices of both platforms → publication in App Store and Google Play → support.

Testing on real devices is not optional. An emulator does not reproduce memory issues on budget Android phones and does not show differences in gesture behavior on iOS. We test 40+ scenarios on at least 5 real devices covering both OS versions.

Project Type Flutter React Native
MVP (8–12 screens) 7–12 weeks 7–12 weeks
Medium (20–30 screens) 3–5 months 3–5 months
Complex (native integrations, AI) 5–8 months 5–8 months

Budget savings compared to two native teams can be up to 40–50%. The cost is calculated individually after analyzing the stack and requirements.

What's included in our work

  • Technical audit and stack selection for your project.
  • Architecture design (clean architecture, MVVM, BLoC/Redux).
  • UI development according to design mockups for both platforms.
  • Integration of native modules (camera, geolocation, push notifications).
  • CI/CD setup (GitHub Actions, Codemagic).
  • Testing on real devices (iOS/Android) — at least 40 scenarios.
  • Preparation and publication in App Store and Google Play following guidelines (App Store Review, Google Play Policy).
  • Technical support for 3 months after launch.
  • Handover of source code, documentation, and access — all turnkey.

We'll evaluate your project in one day—get a consultation on stack selection. Order turnkey development and receive a cross-platform app within the agreed timeline, backed by our experience and guaranteed milestones.