SHIELD BAR WITH HEALTH BAR

Just started using Construct 2? Post your questions here

Post » Wed Apr 05, 2017 7:11 pm

Hello

I am sorry if this question was asked before, but I couldn't find any solution to my problem.

I am a beginner and I am making my first game despite of that fact I have passed the beginner tutorial and I am familliar with the basics.

So, I want to make sort of turn-based space tactical game so you have two ships fireing at eachother in turn-bassed battle and you have commands to issue to your ship., seems like advanced and difficult game to make but I want to do that.

Anyway my problem is making 3 bars that represents "ship's" health status
- first bar represents shield
- secound bar represents armor
- third bar represents Hull

what I want to do is when "enemy ship" is firing you first loose your shields than when shield comes to zero you start losing armor and aventually when armor is zero you start losing hull and than when hull is zero ship gets destroyed.

I also want my shield to slowly regenerate over time.

So how can I do this to have three bars representing health but they will decrease one by one shield first than armor than hull?

Sorry for bad english it isn't my native language.
Best Regards
B
2
Posts: 2
Reputation: 154

Post » Wed Apr 05, 2017 11:20 pm

The easiest way would be to use 3 Progress Bars. Set their "Max" properties to 100.

I'd probably set 3 global variables (Shield, Armor, Hull) to 100 on start of layout in your event sheet.

Then set each Progress Bars "Value" property to each respective global variable.

Then place with these Actions on your event shit:
System > Every 3 seconds > Variable: Add to > Shield > 5

Make a clickable object to reduce the health:
Create Object > txtAttack > = "Attack" as Text

Misc Event:
Mouse> Click > txtAttack > >>> System > Variables > Subtract 20 From > Shield

System > Variables > Compare Variables > Shield is less than or equal to 0 > .... System > Variables > Subtract 20 from Armor

And so on and so forth...
That's how I would start it. But, like you, I am also a novice... just noticed you haven't received an answer yet.
B
12
S
6
G
1
Posts: 27
Reputation: 1,756

Post » Thu Apr 06, 2017 2:53 am

I whipped up a sample capx. To damage your unit, click over the blue box. The bars represent Shields, Armour, and Hull, respectively.
capx
B
42
S
12
G
1
Posts: 74
Reputation: 2,992

Post » Thu Apr 06, 2017 5:35 am

You should check out FTL.
As you can see there are several layers of shields to get through and the programmers only modified the Opacity of the initial Shield ellipse. Check it out real good game.
Image Image Image
B
32
S
12
G
27
Posts: 761
Reputation: 17,244

Post » Thu Apr 06, 2017 9:11 am

Message: kiki443 can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
Thank you for your answers the help is much appreciated.

faulknermano: Your file helped me much in my project so thank you!

MPPlantOfficial: my project is simillar but not the same as FTL the shield won't be graphically visible around ships.

BrandonJAwesome: I will try your solution as well and see if that helps too.

Thanks once again for help.

actually I created an sample myself while waiting it seems that it works.

https://www.dropbox.com/s/u5l0p5ea8hlcgz5/practice01.capx?dl=0
B
2
Posts: 2
Reputation: 154


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 2 guests