# newbie question

Get help using Construct 2

### » Sun Aug 11, 2013 4:11 am

hello,

just new to the program and love it !!!!

I'm trying different thing lo learn and i'm stuck on one:

I want the monster to get more difficult to kill everytime i kill 5 of them...

made a random generator for spawn monster

made a global variable Kill = 0

monster instance variable Health = 1

bullet on colision with monster - monster substract 1 from health
- system add 1 to Kill
- monster destroy

system Kill (greater or equal) 5 - monster set Health to 2

monster health ( less or equal ) 0 - monster destroy

still need only a bullet to kill every monster
and if someone know a better trick to make the monster health go up by 1 everytime i kill 5 of them...
B
4
S
1
Posts: 20
Reputation: 290

### » Sun Aug 11, 2013 4:21 am

You need a global variable to keep track of how many you killed, and then when you spawn a new one add that variable divided by 5 to the health value.

Health = 1 + int(NumberKilled/5)

(the int will drop the fraction, so the partial number isn't greater than your less than or equal zero check.)

Edit: This way it increases every 5 killed. If 25 are killed, the health will be 6.Paradox2013-08-11 04:25:22
B
255
S
65
G
34
Posts: 907
Reputation: 41,611

### » Sun Aug 11, 2013 5:04 am

when i created the global value...
in the TYPE: number doesnt support the 1 + int(NumberKilled/5)
and text does... but do nothing on the game

i try in text,
and add bullet on collision with monster: - monster set health to Health
but not working...
B
4
S
1
Posts: 20
Reputation: 290

### » Sun Aug 11, 2013 6:25 am

and how do we change a behavior value
exemple: i want to change the bullet speed of my monster
B
4
S
1
Posts: 20
Reputation: 290

### » Sun Aug 11, 2013 1:07 pm

Sorry, the 1 + int(NumberKilled/5) should have been 1 + int(Kill/5) if "Kill" was the name of your global variable.

Here is a quick example playable game I made up, using the Health instance variable, and the Kill to count the sprites destroyed.
It speeds up the falling apples (slightly) as well as adding to the health.
https://dl.dropboxusercontent.com/u/85412219/forumposts/AppleShootGame.capx

B
255
S
65
G
34
Posts: 907
Reputation: 41,611

### » Sun Aug 11, 2013 6:04 pm

Thank's

I did it, and still not working...

when i try to open your file, it say i cannot open cause its a r140 or later version.... maybe you made it ou a Mac? i'm windows user...
B
4
S
1
Posts: 20
Reputation: 290

### » Sun Aug 11, 2013 6:11 pm

[QUOTE=tribefx] Thank's

I did it, and still not working...

when i try to open your file, it say i cannot open cause its a r140 or later version.... maybe you made it ou a Mac? i'm windows user...[/QUOTE]

You can download the latest beta version from here if you wish to check out the new features: https://www.scirra.com/construct2/releases
B
24
S
9
G
7
Posts: 756
Reputation: 7,342