The Captain’s Tutorial

Hello, sailor, I hope you’re ready for the adventure. Click here and return to this tab to get started.

source code

Here you are now where only real pirates venture, the so-called source code. That’s where it all happens, all your game’s functioning is written in there. You can start the game by pressing play. Try adding a letter here or there, and you’ll see that nothing works anymore. Fortunately, for that you can do cntrl+Z and go back. In the worst case, you can always go back to the original source code to start from scratch.

les assets

The part of your game you made earlier is called assets. These are all files external to the program such as music or images. They are located in the leftmost part of your source code page.


All your program is divided in full of small islands scattered right to left in different files, we call them functions.

Here’s what they look like:

function lee(){
  println( "Well done, mattey" );

Each function starts and ends with these small brackets { }.

Now find the setup() function in your program.

Found? Each function has a specific role in your code. To use them, they must be called by name, sometimes with instructions. For example, add this line somewhere in the setup() function :

println( "Hi, sailor" );

Don’t forget the semicolon, these little rascals are indispensable. When you have copied the line press play then look what happens in the grey window at the bottom of the source code. That’s it. You made your first change in the program.

Everything that happens in your game takes place in functions. Copy the lee() function I showed you above and paste it into your code, outside a function. Then replace the line you added earlier by this one:


What happened? You created your own function and you called it. Come on, one more point and it’ll be over already!


These little monkeys can be found anywhere, in a function or even outside. Their place has a determining role in your program. For example place the following line somewhere in your code, outside a function :

var captiaine = "Lee";

Then in the lee() function you just created, replace “bravo matelot” by captain without quotes. You will then discover without surprise who is the greatest of the sea wolves.
your turn!

I’m not going to bat you any longer. Now you’re gonna find out for yourself how it all works. Choose one of the following packages to add something to your game and make it work! And don’t forget, if you ever break everything and nothing works anymore, you can always start from scratch by re-downloading the source code.
I forgot, all the lines that start with // have no influence on the program. You will find some everywhere in the code, they are instructions that I left you, as in this example :

// good luck mattey

Trust them! Same thing for paragraphs between /* and */, as follows :

soon the world will discover the
great game you're preparing for us