Skip to content

Calling play() on freshly added tween stops it from playing #5454

Closed
@michal-bures

Description

@michal-bures

Version

  • Phaser Version: 3.24.1
  • Operating system: Ubuntu 18.04

Description

The docs for Tween.play() say "If the Tween is already playing, calling this method again will have no effect."
However as demonstrated by the standalone test case below, superfluously calling Tween.play() immediately after it was added with scene.tweens.add will actually prevent the tween from playing.

Example Test Code

const config = {
  width: 800, 
  height: 600,
  scene: {
    create,
  },
};
const game = new Phaser.Game(config);

function create() {

  const circle = this.add.circle(100,100,20, 0xffffff);
  const tween = this.tweens.add({
    targets: circle,
    duration: 1000,
    x: 400,
    loop: -1
  })
  tween.play()
}

Expected result: circle moves
Actual result: circle remains in place (until you remove the tween.play() line)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions