is it possible to make a health bar from an image?

APPertizingAPPertizing Member Posts: 12
I have made a health bar from an image made up of hearts, I have watched the tutorials on how to make a health bar and used the 200 20 settings. at first it was not working at all then it was dissapearing alltogether. So in change attribute of the (Badie) actor I dropped the game.life-10 to -2 and then when the badie hits the goodie the health bar just basically shrinks from all 4 sides?

I was also wondering as my game screen is much larger than the standard and I have a camera on my main actor if it is possible to have the health bar also move when the main actor moves across the screen? I dont really want it under him I would like it at the top of the screen.I know you can have only one actor followed by the camera is there any other way it is possible?

Best Answer

  • VibraKnifeVibraKnife Posts: 60
    Accepted Answer
    For the health bar, use the replicate action to replicate to a certain number of actors, and when the actor gets hurt, you have health decrease. To do this, make an integer attribute (lets call it "health"), and set it to the number relating to the health of the actor. Now go to the heart actor, and add replicate. In the replicate box, put game.health as how many replications there are. Now under the actor with the health, make it so when it collides with something that damages it, have it change the attribute to game.health-1.

    For the moving health bar, there are two ways you can do it. One way is to make it controlled the same way that the player actor is: by the player. For an example, When you press up on your keyboard, both the player and the health go upwards, but you will need to adjust the camera space. This can be ineffective when running into walls, but it is fairly basic.

    The other way is to put the health on a separate layer, and mark the layer as non-scrollable. It should either stay in the same place or stay on the screen. You may have to make the health movable, but I don't necessarily know how to do it that well. You may have to ask others.

    Hope this helped!

Answers

  • APPertizingAPPertizing Member Posts: 12
    Thanks for your reply Vibra knife but unfortunately that didnt work for me either,The health bar was actually just totally replicating maybe because all of my hearts are part of the one image? Do I need to make seperate hearts for this to work?

    The health bar following my actor around just doesnt look good and it actually goes through the actor when moving up or down maybe because I am using tilt controls? It also was not decreasing when I touch I tried the other way you suggested with the layer but I cant get the layer to come to the front of my initial layer, any way to do this?

    Sorry just a newbie at this!
Sign In or Register to comment.