Killzone, Respawn and Checkpoints

By Wertandrew (Oct 2014)
copied from

NOTE: Kode the following using the search function of the brain editor. All tiles stated below exist in the brain editor except two that you have to create on your own (info below).

First you need to initiate a start point for the respawn to work. To do that, do the following:

1) Go to player brain, go to DO section, go to values >vectors> create new vector. Name it “Player Start Point”. Use that brain tile in step 2

2) Now, inside the player brain Kode:
WHEN [once] DO [global][Player Start Point]=[position]

That will allow the game to remember where you started.

Now, you need to have the player spawn back to start when he/she is dead:

1) Switch to a blank page inside the player brain (using RB)

2) Rename the page “Respawn”. To rename, press menu button > rename page

3) Kode in the page the following:
WHEN DO [position]=[global][Player Start Point]
WHEN DO [revive]
WHEN DO [switch page][1]

This new page will reset the player’s position, revive him and go back into the main player page.

Now we have a respawn mechanism in place, so let’s Kode it to work when the player is dead:

1) Go to the first page of the player, and Kode the following:
WHEN [is dead] DO [fade][transition time][1] (“transition time” is a modifier of fade)

WHEN [countdown timer] DO [switch page][Respawn]

2) Go to the player’s “edit” menu > properties > combat > health & defenses > destrroy after death > set it OFF

So now you have a respawn mechanism in place. That means that even if the player dies from an enemy, he will respawn back to start.

Let’s create a killzone now:

1) Go to player brain and Kode WHEN DO [display] [position] [y] [screen bottom center]

2) Play your level and jump down. Note the number that you want the player to die (usually that should be a number around 10 and minus 10; it is not recommended to have a number lower than minus 10).

3) Go to the player’s brain and Kode
WHEN [position][y][less than][number from step 2] DO [kill]

WHEN DO [velocity]=[zero] (that will keep the player from falling further)

So this Kode will activate when the player goes below that Y value in the full world. That means that the killzone will work everywhere and spawn the player from the beginning of the level.

You are all set!

Additionally, if you want to have checkpoints, all you have to do is:

1) Go to player brain, page 1, in the DO section of any line > values > object > create new object variable > Name it “Player”. Use that tile in step 2 (it should be an apple with a blue background)

2) On page 1, under the [once] rule, add an embedded line (below the player start point initialise we made earlier):
WHEN DO [global[Player]=[me] (Do not use the generic “player” tile, use the one we created in step one)

2) Make a prop (in position where you want the checkpoint to be – logic cube recommended) and Kode inside its brain:
WHEN [in trigger zone][global][Player] DO [global][Player Start Point]=[position]

That will change the saved level start position to the position of the prop. You can copy the prop multiple times now to make multiple checkpoints.

I wrote this guide without having access to PS. If somehow something doesn’t work as intended, comment on this thread and I will revise or provide feedback.


Comments are closed.

Website Powered by

Up ↑

%d bloggers like this: