How do I make a health bar follow the view?

Get help using Construct 2

Post » Thu Apr 16, 2015 7:10 am

:?: 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.
B
3
Posts: 5
Reputation: 190

Post » Thu Apr 16, 2015 7:16 am

Should be pretty easy. Go to instance behaviors and add the anchor function. this will make it stay in place on the screen.
B
10
S
1
Posts: 57
Reputation: 639

Post » Thu Apr 16, 2015 10:24 am

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
Image
B
60
S
10
G
10
Posts: 1,013
Reputation: 9,155

Post » Thu Apr 16, 2015 10:29 am

A0Nasser wrote: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.
The moderators are corrupt and ban for no reason, especially that condescending neckbeard asshole Kyatric. The forums are filled with fanboys.
Banned User
B
22
S
7
G
1
Posts: 558
Reputation: 2,925

Post » Thu Apr 16, 2015 8:55 pm

Thanks for the suggestions, I'll try these out immediately!
B
3
Posts: 5
Reputation: 190

Post » Mon Apr 10, 2017 8:10 am

Omg it worked thx guys
B
4
Posts: 2
Reputation: 204


Return to How do I....?

Who is online

Users browsing this forum: Ajbael, krombanna and 8 guests