0 Favourites

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

  • 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.

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • 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

  • 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'?

  • 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

  • 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.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)