FNF-CNE-Devs / CodenameEngine

awesome fnf engine :D
Apache License 2.0
248 stars 166 forks source link

Bug Report: Broken Healthbar if you change the image #244

Closed CharGoldenYT closed 6 months ago

CharGoldenYT commented 6 months ago

Which target are you using?

[x] Windows [ ] Linux [ ] Mac

Explain your issue

Basically putting a custom healthbar in mods/(insertfoldernameforthemod)/images/game/healthBar.png causes the healthbar colors to incorrectly display ABOVE the image as opposed to below it. it also occurs with assets/images/game/healthBar.png and replicating the internal vanilla healthBar.png's filled in the middle with white (i assumed it was a masking problem based on that) doesnt change it

Please check first if your issue haven't already been reported yet.

yep the only mention of healthbars previously were about the color support (note i am doing a thing to learn the engine atm so its using ourpleV3 assets lol) Screenshot 2024-02-15 213638 Broken Healthbar in Codename Screenshot 2024-02-15 213935 what its supposed to look like hopefully i explained it well enough

Extra note that behaviour is also displayed in this video: https://youtu.be/z2WT4jSBZdE?t=82

Frakits commented 6 months ago

this "bug" happens due to the graphic being placed behind the healthbar. to fix this you need to make a script adding it to the front of the healthbar. (im saying "bug" because its not actually a bug but intended)

liri1222335456 commented 6 months ago

var healthBorder:FlxSprite;

function postCreate() { healthBorder = new FlxSprite(340, 648).loadGraphic(Paths.image('game/youthealthbar')); healthBorder.cameras = [camHUD]; insert(members.indexOf(iconP1), healthBorder); healthBorder.scale.set(1.01, 1); add(healthBorder); }

put this in "data/states/playstate.hx"

CharGoldenYT commented 6 months ago

this "bug" happens due to the graphic being placed behind the healthbar. to fix this you need to make a script adding it to the front of the healthbar. (im saying "bug" because its not actually a bug but intended)

oh ok. i think i get why

var healthBorder:FlxSprite;

function postCreate() { healthBorder = new FlxSprite(340, 648).loadGraphic(Paths.image('game/youthealthbar')); healthBorder.cameras = [camHUD]; insert(members.indexOf(iconP1), healthBorder); healthBorder.scale.set(1.01, 1); add(healthBorder); }

put this in "data/states/playstate.hx"

and also thanks for the script everything is layered correctly now