How do I stop the lifebar from immediately disappearing?

Hello All!

 My monster's entire life bar immediately disappears as soon as the girl fires one shot!  Where did I go wrong?  Inside the variable is  VHealth  100.

Princess of Atlantis

The problem is that you’re changing the LifeBar’s scale width by Vhealth/300. Since Vhealth is 100 or less, Vhelath/300 will be less than 0.033. And I suspect GDevelop rounds this down to 0.

You really want Vhealth/100 to get the bar’s width as a % of health left.

Hey MrMen! How are you? I cleaned up the visual code a bit, though I’m not sure how to get the bar’s width “as a % of health left”. As I have it now, the girl’s first shot takes some life off the monster’s bar. Subsequent shots do nothing. If I just erase the “300” (probably not what you meant), then the bar gets longer instead of shorter.

When the health bar is fixed, it’s time to build, at least version 1. Since I don’t intend to try to do anything commercial with this game, I just grabbed my favorite songs off the internet, unlike my “Seed” game, which has me playing guitar for all the music.

Correct, that’s not what I meant. Replace the 300 with a 100. That should sort out the disappearing bar (assuming the initial scale of the bar is 1) :

Thanks for the help as usual! I still didn’t have the bar right. I have a lot of life bar graphics around at this point, and this one was really big when I dragged it in. That may be what was causing the problems. In the end, I just got rid of the life bar, because it really isn’t necessary. She shoots the monster a few times, killing it, and the last scene opens. My games, especially this one, are more about showcasing my 3D animation than about having a lot of gameplay. Anybody who wants to check it out, you can download the game at the link provided, and play on any computer with Windows. When you’re fighting the monster, move the girl with the “a” & “d” keys, and shoot with the left mouse button.Princess of Atlantis

1 Like

It sounds like you’re having a blast creating your game! Using your favorite songs from the internet adds a personal touch to the experience. It must be quite a contrast from your “Seed” game where you’re creating all the music yourself. It’s great to see you exploring different avenues of creativity in your projects!