time-and-timers

Manage Phaser 4 time-based mechanics with Clock, TimerEvent, and Timeline APIs.

40.1k|7.2k|Updated Apr 12, 2013
One-click install
npx skills add https://github.com/phaserjs/phaser --skill time-and-timers-phaserjs
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: time-and-timers
Source: https://github.com/phaserjs/phaser/tree/main/skills/time-and-timers
Command: npx skills add https://github.com/phaserjs/phaser --skill time-and-timers-phaserjs

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill helps developers coordinate delays, repeats, and timelines using Phaser 4's time-based APIs, enabling precise control over game events.

Core Features & Use Cases

  • Clock-based time tracking to drive timed actions in scenes.
  • TimerEvent for one-shot delays, repeats, pauses, and time scaling.
  • Timeline for sequencing mixed actions (callbacks, tweens, sounds) over time.
  • Pausing, resuming, and timeScale adjustments to implement slow motion or fast-forward.
  • Relative and absolute timing options with flexible event configuration.

Quick Start

Create a one-shot delay in your scene using this.time.delayedCall to run code after a set interval.

Frequently Asked Questions about time-and-timers

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I schedule a one-shot delay in Phaser 4?

Schedule a one-shot delay in Phaser 4 by calling this.time.delayedCall in your scene to run callbacks after a set interval. This TimerEvent API executes code precisely after the specified duration passes.

What is the best way to sequence game events over time in Phaser?

Sequencing game events over time in Phaser is best done using the Timeline API to coordinate mixed actions. You can queue callbacks, tweens, and sounds with relative or absolute timing for synchronized event execution.

Can I pause and resume a timer event in Phaser 4?

Yes, you can pause and resume timer events in Phaser 4 using the Clock and TimerEvent APIs. These controls support starting, pausing, and resuming scheduled actions to manage dynamic gameplay states.

How do I create slow motion or fast-forward effects using Phaser clocks?

Create slow motion or fast-forward effects in Phaser by adjusting the timeScale property on the Clock. This scales the update delta, accelerating or decelerating all active timers and timeline sequences.

Does Phaser 4 support repeating timers across different scenes?

Yes, Phaser 4 supports repeating timers across scenes through the Clock API. You can configure TimerEvents to repeat at specified intervals, coordinating delays and timed actions throughout your game.