health and shield

Get help using Construct 2

Post » Tue Nov 05, 2013 4:22 pm

Hello,
i have a small issue with mine haelth system wich i can't resolve... :(

here's the thing,

I have basic health fom 0 to 100
then i have some powerups that add eg. 10 to health.
then i have shields that start to charge after health is on full 100.

How to add incremental charging with points that are left?

Lets say health is at 95 and powerup is picked up and now i have health at max 100 and mine shield should charge those remaining 5 points.
How to do that?

Thanx!
B
26
S
11
G
2
Posts: 669
Reputation: 5,038

Post » Tue Nov 05, 2013 4:32 pm

You mean like:
If POWERUP > 100-HEALTH then SHIELD=SHIELD+POWERUP-(100-HEALTH) and make
HEALTH=100

Does that offer an idea, or do you need the events to do it?
B
231
S
62
G
33
Posts: 902
Reputation: 40,348

Post » Tue Nov 05, 2013 4:40 pm

thank you for input, i'll look into that.
:)
B
26
S
11
G
2
Posts: 669
Reputation: 5,038

Post » Tue Nov 05, 2013 4:41 pm

@irina,

Think about how you're making things happen.

Having HEALTH and SHIELD affecting your final health (that health seen by the player on the screen), you're able to make separated events to reach it.

For example, to represent the health on screen, use a math like HEALTH + SHIELD (those are variables, the the health with lowercase is a simple text on a text object in your screen).

So, if your player have 95% of HEALTH, and gain a powerup of +10 of SHIELD, your screen will show the 105% of health, simple using the math inside a text object:

everytick -> Text object: "Health: " & HEALTH + SHIELD

Plus, it can improve a lot your work by simple checking wich one you want decrease when hitting an enemy, for example, while physical hits can affect your SHIELD variable first, magical hits can affect your HEALTH variable directly.
Image
B
107
S
24
G
18
Posts: 1,362
Reputation: 22,772

Post » Tue Nov 05, 2013 4:58 pm

@ TELLES0808

I have 2 separated bars, one for health and other for shield.
B
26
S
11
G
2
Posts: 669
Reputation: 5,038

Post » Tue Nov 05, 2013 6:58 pm

@ Paradox

hm... sonething is wrong with this... mine shield gets doubled on each powerup???
B
26
S
11
G
2
Posts: 669
Reputation: 5,038

Post » Tue Nov 05, 2013 8:00 pm

ok, i'w fixed it.
mixup between set value and add value...
B
26
S
11
G
2
Posts: 669
Reputation: 5,038

Post » Wed Nov 06, 2013 11:46 am

Apparently putting a space between the @ and name doesn't send the notification. Not that it mattered.
B
231
S
62
G
33
Posts: 902
Reputation: 40,348

Post » Wed Nov 06, 2013 3:10 pm

@Paradox

Thanx for your help!
B
26
S
11
G
2
Posts: 669
Reputation: 5,038


Return to How do I....?

Who is online

Users browsing this forum: brunopalermo, trance, yiuyiu6666 and 6 guests