Jump to content

Sprite.update() method is never called


NokFrt
 Share

Recommended Posts

Hello,

In Phaser 2 Sprite/Image/... has update() function which is called each step. In Phaser 3 GameObjects also have update() function but this function is never called. I use Typescript. I create a new class which extends Phaser.GameObject.Sprite and I implement my own update() method in the new class. I add an object created from the class to a scene with this.add.existing(mySprite);. Does anybody know where's the problem?

 

Link to comment
Share on other sites

I'm fairly certain this is by design. The examples that I've seen (and the way I do it) is to call the sprite's update function from the scene's update, so:

 

//Scene Class

update(time, delta) {
  sprite.update(time, delta);
  
  group.children.entries.forEach(
      (child) => { child.loop(time, delta); }
  )
}

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...