kill-based scoring

ManlyMouse

  • Posts: 144
I bet this has been asked before but I can't find it on the forums.

I'm using a kill count to increase score so basically:

If KILL COUNT = 2
Set Score +10

So of course this continues to increase my score until I kill another enemy, which breaks the chain. How can I fix?
I know more about Stencyl now.

Tuo

  • *
  • Posts: 2469
Try using a boolean, which is default to "false" and turns to "true" upon a kill. Then you can do (JustKilled? is the boolean):

if KILL COUNT = 2
  if JustKilled?
     set JustKilled? to false
     set Score to Score + 10

The idea is that checking a boolean and then turning it off will make the code only go through once.
Don't look to me but rather to the One who is the reason for what I do. :)

If you need help, send me a PM. Even if I haven't been on in the forums in ages, I still receive those messages via email notifications. You can also reply to any of my forum posts, regardless of the age (especially if I created it), and I will likely reply.

If you want to see the programming behind certain types of games, feel free to check out my "Demo-" games on StencylForge (http://community.stencyl.com/index.php/topic,16160.0.html)

sdieters

  • Posts: 2068
I think he is aiming for something like increase your score with every 2 enemies you kill. In that case you need to use a number attribute that I prefer to call intNum (internal number). So basically you do something like this.

*Everytime you kill an enemy*
Increment intNum by 1
If intNum = 2,
~ increment playersScore by 10
~ ser intNum to 0
My new profile is TheIndieStation.
When you see a recent post with this name, i'm probably using my phone. So dont mind any typo's =p

ManlyMouse

  • Posts: 144
I think he is aiming for something like increase your score with every 2 enemies you kill. In that case you need to use a number attribute that I prefer to call intNum (internal number). So basically you do something like this.

*Everytime you kill an enemy*
Increment intNum by 1
If intNum = 2,
~ increment playersScore by 10
~ ser intNum to 0


Thanks, yup this exactly what i did but I wanted scores to increase exponentially every few kills (like 10 points for two kills, 20 for three, 50 for four" so i left out the last part of "set intnum to 0"

Therefore it keeps applying more points until I make another kill. Is there another way I can do this? I'm thinking something based on a timer (kills made within a certain amount of time....)
I know more about Stencyl now.

sdieters

  • Posts: 2068
ahh a combo counter. thats a whole different story...
well this can be done several ways but the problem is that you either need to have a premade list which contains the amount of points for each combo, or you build your system in such a way that the score per kill increses with each combo. this doesnt give you a persistant score like you said before, but it does give you the combo style score.

try this >> http://www.stencyl.com/game/play/26550

My new profile is TheIndieStation.
When you see a recent post with this name, i'm probably using my phone. So dont mind any typo's =p

ManlyMouse

  • Posts: 144
Hmm so you use a separate combo timer. how can i do something like:

Every 5 secs:

Did score? Yes -->set combo count to +1
Did score? No --->set combo count to 0
I know more about Stencyl now.

sdieters

  • Posts: 2068
so when you kill the first enemy the counter will start, but then you only give yourself a chance of increasing your combo if you manage to get a kill in the next 5 seconds? rather then getting an extra combo count for each kill?
My new profile is TheIndieStation.
When you see a recent post with this name, i'm probably using my phone. So dont mind any typo's =p

ManlyMouse

  • Posts: 144
I know more about Stencyl now.