Examples of how to build things in Indigo using the latest public release.
There are three sections:
- Demos
- Examples
- How to's!
If you try and run a number of these demos and examples back to back, you will likely fall foul of your browsers cache sooner or later. A lot of these demos and examples make use of assets and files with similar or identical names, and this can cause cache confusion.
Consider testing in a private or incognito window, on not your main browser, where you don't mind blowing away the cache from time to time.
Snake is a Mill project, and assuming you have Mill installed can be built as follows from the demos/snake
directory:
mill snake.buildGame
The Cursed Pirate is an SBT project, and can be built as follows from the demos/pirate
:
sbt buildGame
To run either game, instead do:
mill snake.runGame
Or
sbt runGame
See Setup & configuration for more details.
The Cursed Pirate Demo was originally made hastily thrown together in about 5 hours for the first talk that featured / introduced Indigo. The idea was to put together something memorable - not a game - just a small, fun demo.
This version is superficially similar, but is in fact almost a total rebuild of the code base.
Indigo had already changed enormously between the talk in Jan 2020 and the first release in June 2020, and has evolved further since.
So one reason for the rebuild was simply to bring it up to date, but the other was that it wasn't a good example of how to build a game. The original version took many shortcuts, focusing on showing off some of the features of Indigo to an audience via a happy path, rather than worrying about being a reasonable example of how one might build a game.
Hopefully this version is a better example for people looking for inspiration or reference.
All assets bought on itch.io.
Music - Tim Beek - Sea Shanties Pirate Music Pack
Sound Effects - Yal - Yal's Sound Effect Pack
Artwork - Pixel Frog
This Snake implementation was the first full, albeit simple, game made using Indigo.
The code is probably not what we'd do now, but there are some nice aspects to it like the model of the Snake itself and it's tests, and so it's still a useful reference.
The examples a minimal references of how to use a range of Indigo's features. They're not always elegant but they are useful.
It's worth noting that these examples were really put together to aid QA testing - rather than for public consumption. For example in a couple of them all the output is actually in your browsers console! PR's and suggestions to make them nicer are very welcome.
An easy way to run the demos it to run sbt
in the folder, you will then be presented with a welcome message with commands to run all the examples.
To run any example, do the follow (using lighting as an example):
sbt lighting/fastOptJS lighting/indigoRun
The whole lot can be built by running:
sbt buildExamples
As with the demos, you'll need to navigate to the specific demo's build folder and run a local http server.