# health and shield

0 Favourites
• 9 posts
• 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!

• 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?

• thank you for input, i'll look into that.

:)

• 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.

• TELLES0808

I have 2 separated bars, one for health and other for shield.

hm... sonething is wrong with this... mine shield gets doubled on each powerup???

• ok, i'w fixed it.

mixup between set value and add value... <img src="smileys/smiley9.gif" border="0" align="middle" />

• ## Try Construct 3

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

Construct 3 users don't see these ads
• Apparently putting a space between the and name doesn't send the notification. Not that it mattered. <img src="smileys/smiley2.gif" border="0" align="middle" />