How do I make a health bar follow the view?

  • I made a level where a 'camera sprite' follows a character, and then built a health bar that responds to the character colliding With enemies and 'spikes sprite'. I've only started designing about 2 days ago , I still do not understand all variables and event names. I'd like to know if there was an easy way to get the health bar to follow the Camera's view?

    camera tutorial used;

    (not a high enough rep for links)Making a Smooth Following Camera

    Tutorials > Beginner > Tips-and-Tricks > Making a Smooth Following Camera

    Tutorial written by MichelVictor

    hp bar;

    3 sprite layers ; Hp bar (animation) and background color at position of outer frame on Startup.

    Kinda messed with Events, essentially if life = 10 Animation HP BarSprite = frame1 and stop animation, 20 = frame 2 and stop animation and so on.

  • Should be pretty easy. Go to instance behaviors and add the anchor function. this will make it stay in place on the screen.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 1-add new layer

    2-set the layer parallax value in the properties bar to 0,0

    3-add the health bar to the new layer

  • 1-add new layer

    2-set the layer parallax value in the properties bar to 0,0

    3-add the health bar to the new layer

    You use a layer?

    What I do is I make the objects I want in the "HUD" global, and put them on a layout that's just there to "pick up" these elements.

    For this to work though, you have to follow A0Nasser's "set the layer parallax value in the properties bar to 0,0" though.

    Also there needs to be the same amount of layers in all the layouts, preferably with the same name.

  • Thanks for the suggestions, I'll try these out immediately!

  • Omg it worked thx guys

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)