Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
michal-bures opened this issue Dec 18, 2020 · 2 comments
Closed

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

michal-bures opened this issue Dec 18, 2020 · 2 comments

Comments

@michal-bures
Copy link
Contributor

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)

@TwentyPast4
Copy link

This is a pretty serious problem since it is so counter-intuitive. Still happens in version 3.55

@photonstorm
Copy link
Collaborator

Thank you for submitting this issue. We have fixed this and the fix has been pushed to the master branch. It will be part of the next release. If you get time to build and test it for yourself we would appreciate that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants