Variable trouble, please help!

Get help using Construct 2

Post » Sat Sep 28, 2013 12:28 am

Hi, I have started usig Construct 2 recently and prety sure I'll have to send tons of questions. I hope every one will understand.

My problem right now us this one:
I've make a sprite with a variable of health, the initial value of this variable is 100. I've created some item that heal the character: when the sprite of the character is on collision with the sprite of the healer, add 20 to the health value. It's very simple as you see.

How can I made that the value health never rise above 100? In other words, how can I made 100 the maximum value for the variable health?

Any kind of help will be welcomed, thank you much!

Sorry about my bad english
B
4
Posts: 6
Reputation: 247

Post » Sat Sep 28, 2013 12:49 am

When you collect the healing item do a check.

Get healing item and add 20 to health.
If health > 100 then set health to 100

B
101
S
32
G
11
Posts: 1,546
Reputation: 21,667

Post » Sat Sep 28, 2013 12:49 am

If health > 100, set health 100
B
46
S
16
G
77
Posts: 2,164
Reputation: 45,843

Post » Sat Sep 28, 2013 12:50 am

@ArcadEd Ah you got in there a second before me this time lol'd
B
46
S
16
G
77
Posts: 2,164
Reputation: 45,843

Post » Sat Sep 28, 2013 10:18 am

event

on healing
health <=80

action

health + 20
B
19
S
6
G
3
Posts: 197
Reputation: 4,154

Post » Sat Sep 28, 2013 10:19 am

Mother of god! it was really obvious! How can I have been so dumb!
Thank you to every one so much!
Juzkhain2013-09-28 10:19:37
B
4
Posts: 6
Reputation: 247


Return to How do I....?

Who is online

Users browsing this forum: AllanR, BackendFreak and 33 guests