Migration confusion (update, health, camera, etc.)

@samme Thank you very much, it helped a lot!

  1. What if I add the sprite to the scene directly, not into a group? Well, runChildUpdate doesn’t work, but alternatively I could add an event handler for update:
    this.events.on('update', player.update, player);
    But if I need to have a group for using the more convenient runChildUpdate, it’s not a big deal either.

  2. That worked perfectly! PhaserHealth adds very similar functionality than it was present in Phaser 2 (albeit not entirely the same, there are some notable differences, but it’s quite fine).

  3. The mistake I made is that I also need to call scene.cameras.main.setBounds() before startFollow() for it to work.

Meanwhile I got an additional question.

  1. I want to have static text on the canvas that is not affected by camera movements. In Phaser 2, the solution was to add the text to the stage (game.stage); but it seems there is no stage in Phaser 3. I found a FAQ entry that may probably apply here: How can I make a game object stay the same size when the camera zooms?. My situation is not entirely the same because I don’t need to zoom, just keep game objects at a fixed position on the canvas, though I’m not sure if it makes any difference regarding the solution. So do I need to create another scene to display fixed text or is there an easier way?
1 Like