t1k:cocos:playable:tutorials
| Field | Value |
|---|---|
| Module | playable |
| Version | 0.5.6 |
| Effort | high |
| Tools | — |
Keywords: ads, arrow hint, cocos, finger tutorial, playable, tutorials, UI
How to invoke
Section titled “How to invoke”/t1k:cocos:playable:tutorialsFingerTutorial, ArrowHint & TutorialSequence
Section titled “FingerTutorial, ArrowHint & TutorialSequence”Three Cocos Components for guiding the player through the FTUE. FingerTutorial shows an animated finger sprite for tap/drag/hold gestures. ArrowHint shows a pulsing arrow that tracks a moving target. TutorialSequence orchestrates both into step-by-step flows and fires TutorialCompleteSignal via SignalBus. See also: t1k-cocos-playable-signalbus, t1k-cocos-playable-gameflow, t1k-cocos-playable-animation-presets.
Composite Parameter Integration
Section titled “Composite Parameter Integration”See references/tutorial-patterns.md for composite parameter details (TutorialHandParameter, RichTextParameter).
Import paths:
db://assets/PLAGameFoundation/tutorials/FingerTutorialdb://assets/PLAGameFoundation/tutorials/ArrowHintdb://assets/PLAGameFoundation/tutorials/TutorialSequence
FingerTutorial Component
Section titled “FingerTutorial Component”Attach to the finger sprite node. Set targetNode (and dragTargetNode for DRAG) in Inspector or at runtime.
Inspector Properties
Section titled “Inspector Properties”| Property | Type | Default | Description |
|---|---|---|---|
targetNode | Node | null | Node to point the finger at |
dragTargetNode | Node | null | Drag endpoint (DRAG action only) |
action | FingerAction | TAP | Animation style |
loopDelay | number | 0.5 | Seconds between animation loops |
autoStart | boolean | true | Call show() automatically in start() |
FingerAction enum
Section titled “FingerAction enum”export enum FingerAction { TAP = 0, DRAG = 1, HOLD = 2 }Public API
Section titled “Public API”finger.show(); // fade in and begin looping animationfinger.hide(); // fade out and deactivate nodefinger.setTarget(node: Node); // change targetNode at runtimefinger.dragTargetNode = node; // set drag endpoint at runtimefinger.action = FingerAction.DRAG;The node starts with active = false and UIOpacity = 0. show() sets active = true and fades in.
ArrowHint Component
Section titled “ArrowHint Component”Attach to the arrow sprite node. The arrow repositions itself every update() to track a moving targetNode.
Inspector Properties
Section titled “Inspector Properties”| Property | Type | Default | Description |
|---|---|---|---|
targetNode | Node | null | Node to point at |
pulseScale | number | 0.2 | Amplitude of scale pulse (e.g. 0.2 = scales between 0.8 and 1.2) |
pulseSpeed | number | 1.0 | Seconds per full pulse cycle |
autoStart | boolean | true | Call show() automatically in start() |
offset | Vec3 | (0,50,0) | Offset from target in local parent space |
Public API
Section titled “Public API”arrow.show();arrow.hide();arrow.setTarget(node: Node);arrow.offset = new Vec3(0, 80, 0); // adjust offset at runtimeTutorialSequence Component
Section titled “TutorialSequence Component”Orchestrates FingerTutorial and ArrowHint through a series of steps. Wire fingerNode and arrowNode in the Inspector.
Inspector Properties
Section titled “Inspector Properties”| Property | Type | Description |
|---|---|---|
fingerNode | Node | Node carrying a FingerTutorial component |
arrowNode | Node | Node carrying an ArrowHint component |
TutorialStepConfig Interface
Section titled “TutorialStepConfig Interface”interface TutorialStepConfig { finger?: { target: Node; action?: FingerAction; dragTarget?: Node }; arrow?: { target: Node; offset?: Vec3 }; text?: string; // reserved for future label support condition?: () => boolean; // auto-advance when returns true duration?: number; // auto-advance after N seconds}Public API
Section titled “Public API”seq.setSteps(steps: TutorialStepConfig[]): void;seq.begin(): void; // show step 0 and start the sequenceseq.nextStep(): void; // manually advance to next stepseq.skip(): void; // hide everything and fire TutorialCompleteSignalTutorialCompleteSignal
Section titled “TutorialCompleteSignal”export class TutorialCompleteSignal { constructor(public readonly sequenceNode: Node = null) {}}Fired by SignalBus when the last step completes or skip() is called.
Usage Examples
Section titled “Usage Examples”See references/tutorial-patterns.md for complete usage patterns.
Integration Points
Section titled “Integration Points”TutorialSequenceusesSignalBus.instance.fire(new TutorialCompleteSignal(...))— subscribe inGameViewor the FTUE state to advance game flow.FingerTutorialpositions itself in its parent’s local space by convertingtargetNode.worldPosition— both nodes must share a common Canvas ancestor.- Disable
autoStartonFingerTutorialandArrowHintwhen usingTutorialSequenceto prevent them from starting beforebegin()is called. - Clean up subscriptions to
TutorialCompleteSignalinonDestroy.
Common Mistakes
Section titled “Common Mistakes”- Setting
autoStart = trueonFingerTutorial/ArrowHintwhen also usingTutorialSequence— they will start independently beforebegin()is called. - Forgetting to set
dragTargetNodewhen usingFingerAction.DRAG— it silently falls back to the TAP animation. - Not subscribing to
TutorialCompleteSignalbefore callingbegin()— if the sequence is short (duration-based), the signal may fire before the subscription is registered. Subscribe first, then callbegin(). - ES2017 target: do not use optional chaining (
?.) or nullish coalescing (??) in game code.
Gotchas
Section titled “Gotchas”- Tutorials in playable ads have a 5-second budget — past that, networks penalize CTR.
- Skip-tutorial state must persist for the session — replaying tutorial on every retry kills funnel.
- Highlight rectangles need to update when their target moves — static cutout windows lag a frame behind on scroll/animate.