Jump to content

Healthbars in Phaser 3


Recommended Posts

Hello, I am making a top down zombie shooter in Phaser 3.

I am using the moveToObject function to make zombies follow the player. Now I want to make healthbars for the zombies. I have read that you can use containers to make the enemies and healthbars move together but I am having trouble to move the container with moveToObject.

Is it possible to move a container with the moveToObject function or should I use something else instead?

Link to comment
Share on other sites

  • 3 weeks later...

Here's how I'm currently doing it:


      asteroidcontainer = container.add([createAsteroid, miniongraphics]);

                var tween = this.tweens.add({
                    targets: [asteroidcontainer],
                    x: Phaser.Math.Between(-400, -100),
                    duration: 5000,
                    yoyo: false,
                    delay: function(i, total, target) {
                        return i * 600;

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

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