HaxeFlixel / HaxeFlixel/flixel

FlxTween.start() behavior

Open
#2,161 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Haxe
Stars
2.2k
Forks
522
Avg merge
34m
Merged PRs (30d)
1

Description

  • Haxe version: 3.4.7
  • Flixel version: 4.4.2
  • OpenFL version: 8.3.0
  • Lime version: 6.4.0
  • Affected targets: Tested on CPP and Neko

Code snippet reproducing the issue:

package;

import flixel.util.FlxAxes;
import flixel.tweens.FlxTween;
import flixel.text.FlxText;
import flixel.FlxState;

class PlayState extends FlxState
{
    override public function create():Void
    {
        var textRestart = new FlxText(0, 0, 0, "RESTART", 32);
        textRestart.screenCenter(FlxAxes.X);
        add(textRestart);

        var textStartCanceled = new FlxText(0, 72, 0, "START CANCELED", 32);
        textStartCanceled.screenCenter(FlxAxes.X);
        add(textStartCanceled);

        var tweenRestart = FlxTween.linearMotion(
            textRestart,
            textRestart.x,
            textRestart.y,
            textRestart.x + 50,
            textRestart.y,
            true);
        tweenRestart.onComplete = function(tween):Void
        {
            tween.start();
        };

        var tweenStartCanceled = FlxTween.linearMotion(
            textStartCanceled,
            textStartCanceled.x,
            textStartCanceled.y,
            textStartCanceled.x + 50,
            textStartCanceled.y,
            true);
        tweenStartCanceled.cancel();
        tweenStartCanceled.start();
    }
}

Observed behavior:

  • Calling the start() method on a completed FlxTween doesn't restart the tween.
  • Calling the start() method on a canceled FlxTween dowsn't start the tween.

Expected behavior:
Calling the start() method should always restart the tween from the beginning.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the behavior with the Haxe snippet in the issue, then inspect the implementation of FlxTween.start() and its completed and canceled states. Done means calling start() restarts a completed tween and begins a canceled tween from the beginning.

Written by the indexing model from the issue text.

Assessment

Domain
game-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.