# Having a Hard time on Life & Health Logics

Get help using Construct 2

### » Tue May 21, 2013 6:24 am

1st Screenie: http://prntscr.com/15wsyz

2nd Screenie: http://prntscr.com/15wt06

I'm having a hard time, doing the Health & Life Logic, like if you have 2 lives, then your health drops to 0, subtracts 1 to life... then if you have 0 lives then your health drops to 0, you die... thats basically it... help?, just even a pseudo-code would do :)
B
8
S
2
G
3
Posts: 36
Reputation: 2,286

### » Tue May 21, 2013 7:42 am

i'd set a global variable to the max health, lets say for 3 lives, 400 health. then compare global variable. less then or equal to 300, 200, 100 and 0. subtract 1 from your lives variable at each increment. think that'll work. if that is what you are asking?
B
19
S
3
G
1
Posts: 46
Reputation: 1,461

### » Tue May 21, 2013 11:20 am

global variable:

lives     = 3
health    = 400

events    --> actions

lives = 0 --> Game over text, restart game button etc.

health <= 0 --> lives - 1
--> set health to 400

B
18
S
6
G
3
Posts: 197
Reputation: 4,129

### » Tue May 21, 2013 3:17 pm

don't miss to use the conditional "Once while true"
B
92
S
18
G
12
Posts: 1,166
Reputation: 18,090

### » Wed May 22, 2013 5:32 am

awesome! thanks for the replies guys!
B
8
S
2
G
3
Posts: 36
Reputation: 2,286

### » Wed May 22, 2013 5:39 am

@TELLES0808 not to sound so noob, but how would i put trigger once while true in my event sheet? thanks! :)psyko6662013-05-22 05:48:25
B
8
S
2
G
3
Posts: 36
Reputation: 2,286

### » Wed May 22, 2013 7:45 am

global variable's should be set too if restarted ;-) yonda2013-05-22 07:46:10
B
18
S
6
G
3
Posts: 197
Reputation: 4,129

### » Wed May 22, 2013 12:58 pm

[QUOTE=psyko666] TELLES0808 not to sound so noob, but how would i put trigger once while true in my event sheet? thanks! :)[/QUOTE]

@psyko666 you should select it inside the System conditions while adding a new conditional.
B
92
S
18
G
12
Posts: 1,166
Reputation: 18,090

### » Thu May 23, 2013 12:14 pm

what i meant is, where do i place the "trigger once while true" in my event sheet? should i place it together with Life<=0? :(, just refer to the screenie http://prntscr.com/1695mi

thanks!
B
8
S
2
G
3
Posts: 36
Reputation: 2,286