Note: All scripting is done in CoffeeScript!
Levels in CodeCombat quickly exceed the simple pre-existing structure that the Dungeon displays. When you are ready to make a more advanced level, you'll want to make a Referee to control the rules of the level. The Referee has complete control over the map at all times. They can even kill the Hero instantly, if the programmer of a level's so wills it. Below are some tips to get started.
Making a Referee
Add any static Thang to the level and give it a Referee component. We recommend using a Well and placing it out of the field of view.
Explanation of Extra Code
Add the Extra Code field to the Referee to begin your custom scripting.
setUpLevel
This function happens exactly once at the start of the level. This is when you'll want to build the level, as this happens even before the hero is added.
onFirstFrame
This function happens exactly once, as well, but this time this happens after the hero is all set up and about to begin.
chooseAction
This function happens once every frame. This is a good place to custom write some logic.
checkVictory
This is similar to the chooseAction, however this is a good place to delegate all victory checks as convention.
Useful code:
@world.getThangByID "Thang ID"
returns a Thang by it's ID.
@hero
is a predefined variable for selecting the hero.
Advanced Goals
@world.setGoalState "goal-id", "success" # or "failure"
Set a goal state at any time.
- Home
- Archmage Home
- Artisan Home
- Adventurer Home
- Scribe Home
- Diplomat Home
- Ambassador Home
- Archmage General
- Mission statement
- Coco Models
- Coding Guidelines
- Cookbook
- File system
- JSON Schema
- Technical overview
- Testing
- Third party software and services
- Artisan General
- Building A Level
- Coding Guidelines for Artisans
- Editing Thang Components
- Important Artisan Concepts
- Keyboard Shortcuts
- Artisan How-To Index
- Adventurer General
- Scribe General
- Diplomat General
- i18n
- i18n Glossary nb
- i18n Glossary ru
- i18n Glossary es-419
- Ambassador General
- Dev Setup
- Dev Setup: Linux
- Dev Setup: Windows
- Dev Setup: Mac
- Dev Setup: Vagrant
- Dev Setup: Issues
- Game Engine
- Component
- Multiplayer
- Surface
- System
- Thang
- Thang Component System
- Tome
- World
- Artisan Tabs
- Components And Systems
- Scripts
- Settings
- Thangs
- Other
- Aether
- Client models
- Developer organization
- Educational Standards
- Events, subscriptions, shortcuts
- Chat Room
- Chat Room Rules
- Permissions
- Project Ideas List
- Treema
- Versioning
- Views
CodeCombat | Home | Blog | Forum | Teachers | Legal | Contribute