Simple Kill Score System

By LadylexUK (Dec 2014)
Copied from ProjectSpark.com

There are a few methods for creating a kill count (which can be converted to a score). This one is for when you kill a goblin. The goblin’s death is what increments the score.Obviously you can use this Kode for any enemy character (zombies, wolves, etc)
This tutorial was created in response to a post in Koding Konversations by Black Bauer.

Score housed in players brain (preferable)

In your templated or placed goblin

WHEN [hit by attack] DO [objvar:my attacker][=][it]
…WHEN[started to][is dead] DO [objvar:my attacker][numvar:score][increment by][1]

This will increment the score variable in the player brain who last hit it. Good for multiplayer or single player.
If your player is destroyed, the variable will go with it. Make sure you have created a respawn system that uses revive rather than destroy on death, for this to work.

Turn destroy after death to off on player. In player brain.

WHEN [is dead]
…WHEN DO [numvar:lives][<][3]
…/…WHEN [countdown timer][2] DO [position][=][IWP:Respawn point][position]
…/…/…WHEN DO [revive]
…/…[Else] DO [game over] (or start a game over sequence by switching page)
WHEN [started to][is dead] Do [numvar:lives][increment by][1]

This gives player 3 lives before he will not revive again.

Score housed in separate logic cube

In your templated or placed goblin

WHEN [started to][is dead] DO [IWP: score cube][numvar:score][incremented by][1]

This is only good if your game has only 1 player, because there is only one score variable.

Score housed in a global variable

In your templated or placed goblin

WHEN [started to][is dead] DO [global][numvar:score][incremented by][1]

Again, only good if there is only 1 player.

You will need to put your display score in a logic cube or the players brain

WHEN DO [display][screen top right][text: “SCORE: “][wherever it is housed (global, player brain, l

Comments are closed.

Powered by WordPress.com.

Up ↑

%d bloggers like this: