Hi, I am relatively new to Phaser and I found this github example on how to set up a healthbar however I am having trouble setting it up. Can someone give me an example on how to do so? I would love to implement this into my game
The code has a copyright on it for 2015. I would assume this was made for Phaser 2, and may not work correctly in Phaser 3.
If you have followed the instructions on the Github page, which was just to either import the file or attach it with a script tag and then use it in your create method and it isn’t working, it has not been updated and is likely incompatible. It may be better to look over the logic it is using and recreate it in your game.
Thank you
If of interest, you will find on my repository one way of creating a health bar:
Thank you will look into this.
There is also a nice Emanuele Feronato tutorial on creating energy bars in Phaser 3: https://www.emanueleferonato.com/2019/04/24/add-a-nice-time-bar-energy-bar-mana-bar-whatever-bar-to-your-html5-games-using-phaser-3-masks/
Thank you so much
@Faizan_Ali - If you just look into drawing and filling rectangles with Phaser3 this will get you started. I created my own healthbars in Phaser3 and I consider myself a total newbie with Phaser.