DEV Community

FrameSprite for FrameSprite

Posted on Originally published at framesprite.com Fully Autonomous

Why does slowing one HaxeFlixel attack also slow idle or leave playback paused?

Disclosure: This draft was generated with AI and checked against the cited primary sources, with a separate AI editorial review. It was prepared for the FrameSprite team, which has a commercial interest in FrameSprite. Proposed examples are not executed tests unless explicitly identified as recorded fixture results.

Use an individual FlxAnimation's timeScale when only that action should change speed. Use the controller's timeScale when every animation on that sprite should change. Check paused separately when playback does not resume. The FlxAnimation API explicitly distinguishes its local setting from controller-wide timing.

Key Takeaways

  • Keep global game time, sprite-controller time and action-local time separate.
  • Store temporary slow-motion ownership so the next action does not inherit stale state.
  • A paused animation needs a pause policy, not only a new speed value.

Identify the narrowest timing owner

Imagine one character with idle, attack and hurt actions. You want the attack to read more clearly, without slowing the idle loop that plays afterward. Changing a controller-wide value affects the controller rather than expressing an attack-only design choice.

First log the current animation name, local timeScale, controller timeScale and paused state. If the game also changes FlxG.timeScale, record it. The FlxG API exposes global engine settings; do not assume an action-local assignment explains every timing change.

This is about playback policy, not the number of drawings. The frame-count guide helps distinguish those inputs.

Apply the local change deliberately

For an action already defined in the controller, a setup fragment is:

// Current HaxeFlixel 6.x API; local animation timeScale exists since 5.4.1.
// Not compiled or run here.
var attack = sprite.animation.getByName("attack");
if (attack != null) {
    attack.timeScale = 0.5;
}
Enter fullscreen mode Exit fullscreen mode

The hypothetical value means the action's timing is intentionally reduced relative to its ordinary setting. It is not a promise about observed wall-clock duration under every global clock or imported frame duration.

The controller reference provides its own timing and pause state. Keep a temporary controller-wide effect in the system that owns that effect, and restore it when the effect ends. Avoid scattered resets in idle, hurt and menu code.

Treat pause and speed as different controls

A speed change does not explain why an action is paused. Decide whether pause means the whole actor, the current animation or the game simulation. Resume through the appropriate API and make that transition explicit.

An attack that changes to hurt while paused needs a defined outcome. Should hurt remain frozen with the actor, or should the interruption resume it? Either policy can be reasonable, but an accidental inherited pause is difficult to diagnose.

Desired result Inspect or change
Slow only attack The attack's local timing
Slow all actions on one sprite Controller timing
Freeze an animation intentionally Pause/resume state
Slow the simulation broadly Global time policy and dependent systems

For gameplay contact, avoid moving hit timing solely by slowing the visual action. Review the hitbox timing guide before coupling a damage interval to presentation speed.

Acceptance through transitions

Compare idle to attack to idle, attack to hurt, and pause to resume. Log timing ownership at each transition. Confirm the temporary effect ends once and does not leave the next action unexpectedly slow.

Repeat with any project-wide slow-motion feature disabled, then enabled. Record the intended interaction in the handoff checklist. No timing run was performed for this article; the described API behavior is source-based and the example values are a design illustration.

Review authored frame durations

Inspect any per-frame duration data imported with the action before concluding that the timeScale setting is ignored. A long hold pose can make the action feel uneven even when the overall speed multiplier is applied consistently. Compare a deliberately uniform diagnostic action with the imported action, using the same controller settings. Keep authored timing and temporary gameplay slow motion in separate records. Changing one to conceal an error in the other can leave the original animation contract unclear and make future revisions difficult to compare.

Sources and editorial ownership

Primary references checked on October 20, 2026:

Editorial owner: FrameSprite Workflow Team. Editorial and verification policy. Report a documentation correction.

Top comments (0)