Science Oxford Logo

CCC - Code Adventure

Resources for the 'Code Adventure' Creative Computing Club.

During this workshop, you will write and program a 'Choose your own Adventure' style story using Twine.

This page recaps what we discussed as a group.

To jump to the section on changing colours, click here.

To skip to the examples and ideas, click here.


Getting started

Visit: twinery.org/2

You should see a screen like the below picture. If you get a welcome message first, click 'skip'.

screenshot of the Twine dashboard, with menu buttons at the top. First row: Story, Library, Build, View, Twine. Second row: New, Edit, Tag, Rename, Duplicate, Delete.

To continue working on a saved project (for example from our in-person workshop), click Library -> Import, then upload your saved file.


Click the + New button on the top left and type in a title, then click ✓ Create.

screenshot showing the steps described above. Clicking New from the menu brings up a new box with space to add a title. Create is underneath the title, in green font.

You should now see a screen like the below picture:

screenshot of the Twine editor, with menu buttons at the top. First row: Back, Passage, Story, Build, Twine. Second row: New, Edit, Rename, Delete, Test From Here, Start Story Here. The rest of the space is blue with gridlines. A box has the text: Untitled Passage Double-click this passage to edit it. Connected to the box is a green icon of a rocket.

Beginning your story

Double click on the Untitled Passage - this will be the opening paragraph of your story!

Write a sentence to set the scene, then decide on a couple of options your reader can choose from.

Write your options in double square brackets [[choice]], and new passages will be created and automatically linked to your first paragraph!

Click the x in the top right corner when you have finished editing the passage.

Example:

You arrive at Science Oxford's Creative Computing Club workshop and notice that something isn't right...
Instead of a laptop on each desk, there is a strange square box!
[[Prod the box]]
[[Go and look for help]]
screenshot of the editor. The Untitled passage now has story text inside. Connected to the bottom with two arrows, are two new passages. One is titled 'Prod the box', one is titled 'Go and look for help'.

Now test your story!

Click on your first passage (the box with the rocket icon), then click the 🔧 Test From Here button on the menu at the top.

This should open your story in your web browser. Click on your options to test that they work.

Go back to the Twine editor, to carry on creating your story.


Saving your story

To make sure that you do not lose your work, download your work regularly.

Save your story to your computer by clicking Build, then Publish to File from the top menu.

publish to file screenshot

This will save it on your computer - probably in your downloads folder.

Do this any time you make significant changes!


Changing colours

To change the colours, and other formatting such as fonts, we are going to use CSS and edit the stylesheet, which can be found by clicking Story then # Stylesheet in the menu.

Anything you add in here will change the formatting for your story - add things one at time, close the stylesheet, then check your story using the Play button.

If you make lots of changes at the same time, it can be very difficult to debug any problems!


Example 1:

tw-story{
  color: #fcba03;
}

The example code above will change the text colour of your story to a mustard yellow colour.

Click here to find colour hex codes.


Example 2:

tw-story{
  background-color: #fcba03;
}

tw-passage{
  color: #000000;
}

tw-link{
  color: #249140;
}

The example code above will change the background colour of your story to a mustard yellow colour, the paragraph text to black, and the link text to dark green.

Click here to find colour hex codes.


What next?

Continue to write your story with as many branches as you can think of!

The links below will help you to code some extra features into your story.