How do I level up the player on every 5 kills?

Get help using Construct 2

Post » Wed May 18, 2016 5:52 pm

Hello,
I want to know how can I level up the player (add 1 to the global variable Level) on every 5 kills?
What about on every 5 + (level * 2) kills?
For example if I am level 0 I only have to kill 5 enemies.
Next, I am level 1, so it should be 5 + (1 * 2) = 7 enemies.
Level 2, 5 + 4 = 9 enemies.
How can I do this?

I try to add to the global variable one, but it seems like it adds one on every single tick not just once.

Update: This got fixed, but a new problem is described below.
Last edited by GSquadron on Thu May 19, 2016 10:48 am, edited 1 time in total.
B
24
S
7
G
1
Posts: 200
Reputation: 2,495

Post » Wed May 18, 2016 6:43 pm

Create a variable for kills to next level.

On Enemy destroyed> add 1 to kills.

kills>=kills to next levels then add 1 to level, wait 0 seconds, subtract kills to next level from kills, wait 0 seconds, add 2 to kills to next level.

I added the kills and other variables to the player object.

Probably should add the system condition "trigger once while true" to the kills=killstonextlevel event.

https://www.dropbox.com/s/t33wvsdkahh60 ... .capx?dl=1
B
15
S
6
Posts: 85
Reputation: 1,195

Post » Thu May 19, 2016 10:47 am

Thanks man, the 'trigger once while true' did wonders.

Now I have a new problem.
Whenever the enemy collides with the player, I want the player to get his health removed every 1 second.
Unfortunately, it happens only once.
I tried adding 'repeat every 1 second' as a sub-event, but does not work.

Also, how do I do 'not colliding with'?
B
24
S
7
G
1
Posts: 200
Reputation: 2,495

Post » Thu May 19, 2016 3:59 pm

you cant do "not colliding with" because that is what that trigger is for. Kinda silly at that point.

But have you tried timer do when colliding start timer of 1 sec

when timer ends -1 hp. I fear that the problem is that when you collide that its repeating the event so it reset the action infinite at the beginning.

But id like to know about this i currently have the same problem. Timer did work for me somewhat lol
B
51
S
24
G
6
Posts: 391
Reputation: 7,820

Post » Thu May 19, 2016 4:36 pm

Never mind man, I just fixed the problem. Instead of colliding with, make overlapping with, then right click and select invert.
It does what I wanted it to do.
B
24
S
7
G
1
Posts: 200
Reputation: 2,495


Return to How do I....?

Who is online

Users browsing this forum: FlyingRam, jkmalau, marcinkowski and 10 guests