Skip to content

[Phaser 3.50] Phaser.Time is undefined in Phaser.Time.Clock#addEvent  #5294

@EmilSV

Description

@EmilSV

Version

  • Phaser Version: 3.50.0-beta.5
  • Operating system: Windows 10
  • Browser: chrome and firefox

Description

if you import phaser with webpack

Phaser.Time is undefined in method Phaser.Time.Clock#addEvent

Example Test Code

import Phaser from "phaser";
import logoImg from "./assets/logo.png";

var config = {
  type: Phaser.AUTO,
  parent: "phaser-example",
  width: 800,
  height: 600,
  scene: {
    preload: preload,
    create: create,
  },
};

var game = new Phaser.Game(config);

function preload() {
  this.load.image("logo", logoImg);
}

function create() {
  var logo = this.add.image(400, 150, "logo");

  var _this = this;

  this.time.addEvent({
    delay: 10000,
    callback: function () {
      _this.tweens.add({
        targets: logo,
        y: 450,
        duration: 2000,
        ease: "Power2",
        yoyo: true,
        loop: -1,
      });
    },
  });
}

Additional Information

most likely Phaser.Time.TimerEvent should be TimerEvent in "phaser\src\time\Clock.js"

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