switch page

switch page



Kode wheel segment Brains
Style Brain control
Modifiers None
Primarily WHEN/DO DO
Pre-made brains that use it Helpful guard
Enemy -Scavenger Hostile Creature

Brains> switch page


This tile allows you to run kode on a different page in a brain. The kode on a page will only run if it is being accessed. Brains first run page 1 by default (this can be changed in Brain properties). You can reference a page by number or name. Page numbers can change if pages are added or deleted before the page, and page names can change if you rename the page, so in that instance you will need to change the reference – it will not happen automatically. All the variables that have been set in the brain will be accessible by all pages in the brain. So, if you set a number variable on page 1 and switch page the variable is still the same number. However, elements such as music or effects or display that have been programmed to run on one page will cease when you switch page.

Example code

WHEN [once] DO [switch page][1]


WHEN [once] DO [switch page][text:Flee]



Other Uses

Switch page can be used with levelling to expand a players abilities. Page 1 is the character at level 1, Page 2 is the character at level 2 etc. Controls can be changed, abilities added, attack damage or health levels can be altered. Be aware that you should put any kode that is needed for all levels on each page or with a call page link to a page of universal elements.

You can also use switch page to an empty page to stop the brain from running without actually turning the brain off using [deactivate brain] or [brain is active] [equals] [false].

Switch page is often used to add an element that needs a timer, that is started by a single frame action (such as Interact). Common uses:

page 1

WHEN [interacted] DO [switch page][2]

page 2

WHEN [duration timer][4] DO [display][text: The door magically opens!][above]


Switching pages in a character brain which has a camera can cause the camera to “jump” even if you use the same camera on both pages. If you are using switch page in a character brain, remove the camera and put it in a logic cube with the following kode to prevent the camera issues:

WHEN DO [IWP:hero][follow camera]

Comments are closed.

Powered by WordPress.com.

Up ↑

%d bloggers like this: