How do I set up health pick up?

Get help using Construct 2

Post » Mon Aug 17, 2015 2:15 am

Hi guys .. I wanna make a health potion that once you grab it, it'll heal you to full health.
Problem is how can I tell game to only heal my lost health not adding it.

i.e :

500/500 - 200 = 300/500 -> Grabs Health Pickup -> Full Health 500/500 <-- this is what I wanna tell my game

Not

500/500 - 200 = 300/500 -> Grabs Health Pickup -> 800/500 <-- not what I wanted :(

Note : I dont use global variable for this.

Btw I'm a visual learner.. hopefully you guys can post example .capx cause I don't understand text as much.
I wish I could post my .capx but my rep is <300 :(
B
5
S
1
Posts: 14
Reputation: 409

Post » Mon Aug 17, 2015 3:31 am

You can make another instance variable with the name "maxhealth" and set it value to 500, when you want to restore hp, just set your "health" value to "maxhealth".

Or use math: set health to min(health+x,500). Change x to whatever value you want, Health will never be greater than 500.

Example: https://dl.dropboxusercontent.com/u/101 ... oreHP.capx
B
24
S
4
G
2
Posts: 41
Reputation: 1,543

Post » Mon Aug 17, 2015 10:22 am

Message: achik1990 is not yet permitted to post plain text URLS (300 rep required). 1 URLS removed. Why?
feyninja wrote:You can make another instance variable with the name "maxhealth" and set it value to 500, when you want to restore hp, just set your "health" value to "maxhealth".

Or use math: set health to min(health+x,500). Change x to whatever value you want, Health will never be greater than 500.

Example:


OMG OMG OMG your math solution worked!!!! <3 <3

I love you soo much <3

thank you..thank you..

you have my eternal gratitude <3
B
5
S
1
Posts: 14
Reputation: 409


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 79 guests