Intro
Welcome! Today, we’ll create a new level using CoCo’s level editor that involves character movement, fighting, and some decorations!
Steps
- Start by creating a new level in the level editor. Feel free to name it anything you want. (I named it Treasures of Kithgard)
- Create an 80 by 64 dungeon floor. Like this:
- Add a Hero Placeholder Thang anywhere in the map(We’ll change the position later.
- Place dungeon walls around the floor(2 layers)
- Start creating your maze. I used movement stones, dungeon walls, and dungeon stairs.
Make sure to check that the spacing between each movement stone is 12 meters(Or 3 shifts with the stone). This is because we are making so simple boots are used. Here’s a screenshot of mine:
- As you can see in the above image, there are some cave-ins. These allow ogres to hide and wait for the hero to approach.
- Add a munchkin to each “booth”(Cave-in) in your level. Then set their vision.sees() distance to 10m.
- Add a gem in front of each ogre munchkin
- Add a goal trigger at the end of the maze
- Go to the settings tab of the level and create the following:
- Add a referee to your level. (It is recommended you place it where you can see it. Don’t worry, it’s invisible in play mode)
- Double Click the referee
- Go to misc.referee and click the plus button. In the dropdown menu, select extra code.
- Referee’s code language is Coffeescript, but the structure is similar to unity’s C# script. Type in the following code in the referee extracode: (You might need to change the number 20 to something else)
{
setUpLevel: ->
@inventory = @world.getSystem("Inventory")
@inventory.teamGold.humans.income = 0
@inventory.teamGold.humans.earned = 0
@inventory.teamGold.humans.gold = 0
#onFirstFrame: ->
#chooseAction: ->
checkVictory: ->
if @inventory.teamGold.humans.collected==20 # Change this to GemCount*5
@world.setGoalState("collect-gems", "success")
if @inventory.teamGold.humans.collected<20 # Change this to GemCount*5
@world.setGoalState("collect-gems", "failure")
}
- Try your level, it should work as expected! Here’s mine: https://direct.codecombat.com/editor/level/treasures-of-kithgard
Congrats! You've finished creating a simple level with a goal point!
Things we covered:
- Maze creation and decoration
- Gem inventory system
- Basic referee coding
- Editing components
As an extra challenge, try adding doors, and maybe documentation! Good luck!