Q: How do I define a treasure?
A: According to the jam rules, "All treasures must be flagged as treasures and coloured differently to normal objects." This means there are two things you need to do. Firstly, you need to tell Adventuron which objects are treasures. Secondly, you need to use colour to tell the player which objects are treasures.
1. Telling Adventuron about treasures
All your objects are defined in the objects{} block. For example, for a simple game with only one moveable object, the objects{} block may look like this:
objects {If you want the object to be a treasure, all you have to do is include 'treasure = "true"' as follows:
gold_nugget : object "a gold nugget" start_at="start_room";
}
objects {
gold_nugget : object "a gold nugget" start_at="start_room" treasure="true";
}
That's all there is to it. Adventuron does the rest.
2. Telling the player about treasures
In order to colour the treasures, you have two options:
- Use a theme.
- Do it manually.
2.1 Using a theme
Using a theme is the easiest way to define the treasure colour and most people will use this for the jam. If you use this method, then all treasures are coloured the same way, including the article (a, an, some or the), and treasures are only coloured when included in lists, not in messages. This is not a problem for the jam, as the rules state that articles are not to be included in lists and the auto redescribe option is to be used so that you don't get messages like "You get the gold nugget" and "You drop the gold nugget".
When using a theme, you have three options:
- Use the inbuilt theme that is used by TWO and use its rainbow treasure colour.
- Extend the inbuilt theme that is used by TWO and override the treasure colour.
- Use your own theme with your own treasure colour.
2.1.1 Using the TWO theme
To use the TWO theme, declare the start_theme as follows:
start_theme = two
2.1.2 Extending the TWO theme
To extend the TWO theme, create your theme and declare it as the start_theme as follows:
start_theme = my_theme themes { my_theme : theme {
extends = two
colors {
treasure_pen = colour
}
}
}
In order to avoid syntax errors, you should define your theme, before declaring it as the start_theme.
"colour" is a placeholder. We'll come back to it in a moment.
2.1.3 Using your own theme
To use your own theme, create your theme and declare it as the start_theme as follows:
start_theme = my_theme themes {
my_theme : theme {
colors {
treasure_pen = colour
}
}
}
Once again, in order to avoid syntax errors, you should define your theme, before declaring it as the start_theme.
2.2 Defining colours
There are a lot of things that can be changed using themes, but at the moment, we're only interested in the treasure colour. There are three ways to define the colour.
- Use a colour index.
- Use a hexadecimal red-green-blue (RGB) value.
- Use a pre-defined rainbow palette.
2.2.1 Using a colour index
Use a colour index in your theme as follows:
treasure_pen = n
where n is a number from 0 to 15 corresponding to the following colours:
0 = black
1 = dark blue
2 = dark red
3 = dark magenta
4 = dark green
5 = dark cyan
6 = dark yellow
7 = grey
8 = orange
9 = bright blue
10 = bright red
11 = bright magenta
12 = bright green
13 = bright cyan
14 = bright yellow
15 = bright white
2.2.2 Using an RGB value
Use a hexadecimal RGB value in your theme as follows:
treasure_pen = #RGB
where R, G and B and the hexadecimal values (0-9, A-F) of the red, green and blue colour components. In case you're not familiar with hexadecimal, all you need to know is that the values of A to F are equivalent to decimal values of 10 to 15.
2.2.3 Using a rainbow palette
Use a rainbow palette in your theme as follows:
treasure_pen = #r
where 'r' is a character (meaning rainbow), not a value.
When using a rainbow palette, each character of each word is coloured in the order red, orange, yellow, green, light blue, dark blue, purple, then starts again.
2.3 Doing it manually
If you want to be even more creative (such as not colouring the article, using different colours for each treasure or alternating colours for each character), then you can colour the object description directly as follows:
objects {
gold_nugget : object "a <gold nugget<colour>>" start_at="start_room" treasure="true";
}
The colour is defined in the same way as described above. Here's a simple example where the object description is coloured yellow, but the article isn't:
objects {
gold_nugget : object "a <gold nugget<14>>" start_at="start_room" treasure="true";
}
The advantage of doing it manually is that the treasure is always coloured in the way that you want it coloured wherever it's used, including in messages.