Catching Tap Count
This page will explain in detail how to catch the players taps on the Ultimate Joystick.
The Ultimate Joystick has many different Events that can be subscribed to with custom functionality for your players. The two events that can be used for detecting taps on the joystick are: OnTapAchieved and OnTapReleased. Below I will show very simple examples of how to subscribe to these functions.
OnTapAcheived
OnTapAchieved Event
The OnTapAchieved
event is one of the interactive events provided by the Ultimate Joystick component. This event is triggered when the player taps the joystick successfully. The tapCount
parameter in the event's signature indicates the number of consecutive taps the player has made on the joystick, allowing you to react differently based on the tap count if needed.
To subscribe to the OnTapAchieved
event, you can attach a custom function that defines what should happen when the event is fired. Here's a simple example of how to subscribe to the OnTapAchieved
event and log a message to the console:
In this example, whenever the OnTapAchieved
event is triggered, the attached anonymous function is called, logging a message indicating the number of times the joystick was tapped.
OnTapReleased
OnTapReleased Event
The OnTapReleased event is another interactive feature of the Ultimate Joystick. It is triggered when the player releases a tap on the joystick within a predefined time window. This can be useful for registering tap-and-hold actions or differentiating between tap types.
To hook into the OnTapReleased event, you simply need to subscribe a function that specifies the desired behavior upon the event's invocation. The example below demonstrates how you can subscribe to the OnTapReleased event and output a message to the console confirming the action:
With this code snippet, whenever the OnTapReleased event occurs—signifying the end of a tap within the Tap Decay Rate—a logged message will inform you that the joystick tap has been released within the time window.
Last updated