# Enemy Life Help

Get help using Construct 2

### » Sat Aug 24, 2013 12:37 am

Hi guys!

I am trying to develop a Tower defense game for touch devices.

I cant understand this code...help!

THANKS!:)
B
9
S
2
Posts: 82
Reputation: 914

### » Sat Aug 24, 2013 3:39 am

CurrentHP and MaxHP are both Instance Variables of an object called enemy. Does that help?
B
101
S
32
G
12
Posts: 1,549
Reputation: 22,103

Thanks!

but way *50?

B
9
S
2
Posts: 82
Reputation: 914

### » Sat Aug 24, 2013 4:17 am

That's the maximum width it will draw the bar when Current/Max = 1. Everything else is a proportional fraction of that width.
B
71
S
22
G
288
Posts: 3,860
Reputation: 158,426

### » Sat Aug 24, 2013 4:58 am

@blackhornet

THANKS!You have some sample of it like capx.?
so that i have some reference... :)
B
9
S
2
Posts: 82
Reputation: 914

### » Sat Aug 24, 2013 5:08 am

This is a previous example:
Creating Progress Bars

Event 13 uses the same calculation.blackhornet2013-08-24 05:09:56
B
71
S
22
G
288
Posts: 3,860
Reputation: 158,426

### » Sat Aug 24, 2013 8:15 am

Just in case to clarify a little bit more without looking at the capx:

When life is 1, the bar width will be 50 (50*1=50)
When life is 0.5, the bar width will be 25 (50*0.5=25)
When life is 0, the bar width will be 0 (50*0=0)
B
15
S
6
G
3
Posts: 35
Reputation: 3,992

### » Sat Aug 24, 2013 8:32 am

@lukedirago

Thanks! I have one more problem is

why my Current/max is at the middle of the monster, instead on the top...

B
9
S
2
Posts: 82
Reputation: 914

### » Sat Aug 24, 2013 9:13 am

have you set the imagepoint on top of the enemy?
B
19
S
6
G
3
Posts: 197
Reputation: 4,154

@yonda

Yeah!
help... pls :(

Thanks!
B
9
S
2
Posts: 82
Reputation: 914

Next