Play Home Contribute Github Join Us! Discourse Staff Members Github Contribution Guides Team

Editing the Level Code


I’m creating my own level with the level editor.

I have asked this question before, but I’m still confused.

What part of the code should I change and what should I change it to?

Here’s what I want to do:

  • Make the Ogres passive until hero attacks it
  • Make the Ogre drop a gold key upon death
  • Make another Ogre kill the hero upon death
  • Randomly generate which ogre will kill the hero and which one will drop the key
  • Assign the ogre a special Id
1 Like

We have a thing called a “Referee” which looks like a well. Add that to your level and navigate to it’s components (double-click on it) and go to the “misc.Referee” component. Inside the Referee’s misc.Referee component click the [+] and add “extraCode”. Now, finally, inside that extraCode you can add these custom functionality. Note that this is in CoffeeScript, not JavaScript/Python/Lua

setUpLevel happens once before the level starts.
onFirstFrame happens during the first frame of the level.
chooseAction happens every frame of the level.

1 Like