This repository includes the open-source code for my game TLoZ: Link's Escape programmed using Sprig, an open source game console, web-based game editor, and hardware development kit. This also works as a template for you to implement your own games.
The aim of the game is to get the highest score possible, here's an overview of the mechanics:
- Click on the game screen to get started, then use
K
to start the game and jump andJ
to restart the level. - Sometimes there will be Lynel instead of a Moblin, they run fast, so be ready!
- If you see an enemy briefly change colour when it spawns in, then it's going to jump, so don't try to jump over it.
- The game will get exponentially faster the longer you survive.
- Link slowy gets further and further away from Gannon's Castle and closer to his house.
- However, when he get's there, something's not quite right...
- Try to beat my high score of 308! :)
██████████
████▒▒▒▒▒▒▒▒▒▒████
██▒▒▒▒░░░░░░░░▒▒▒▒▒▒████ ██
██▒▒░░░░░░░░░░░░░░░░▒▒▒▒████ ██░░██
██▒▒▒▒░░░░▒▒▒▒▒▒▒▒░░░░░░▒▒▒▒████░░░░ ██
░░░░▒▒▒▒▒▒▒▒ ░░▒▒▒▒▒▒▒▒░░▒▒▒▒████░░░░ ██
░░ ░░▒▒▒▒░░ ░░▒▒▒▒▒▒▒▒▒▒▒▒▒▒██░░░░ ██
▒▒░░▒▒ ░░ ░░▒▒████▒▒▒▒▒▒██░░░░ ██
▒▒ ░░ ▒▒▒▒▒▒▒▒░░▒▒░░ ░░▒▒████▒▒▒▒██░░ ██
▒▒ ░░ ██▒▒▒▒░░▒▒░░▒▒░░▒▒ ▒▒████████░░ ██
▒▒░░▒▒ ████░░░░██████▒▒░░▒▒████▒▒▒▒██░░░░ ██
▒▒▒▒▒▒░░▒▒██░░░░░░██ ██▒▒▒▒▒▒░░░░████░░░░ ██
▒▒ ▒▒▒▒██░░░░░░██░░ ░░ ▒▒░░██▒▒██░░░░ ██
▒▒▒▒░░░░░░░░░░░░░░░░ ▒▒██▒▒▒▒██░░ ██
▒▒██░░░░░░░░░░░░░░ ████▒▒▒▒██░░░░ ██
██████░░░░░░████░░████▒▒▒▒▒▒██░░░░ ██
██████████ ░░▒▒████████▒▒▒▒▒▒██▒▒██▒▒▒▒██░░░░ ██
██▒▒▒▒▒▒▒▒▒▒██▒▒▒▒▒▒▒▒░░░░▒▒██████▒▒▒▒██▒▒ ██░░██
██ ████████▒▒██▒▒░░░░░░░░▒▒██████▒▒░░▒▒▒▒██ ██░░██
██ ██ ██████▒▒██▒▒▒▒▒▒▒▒▒▒▒▒████▒▒▒▒░░░░████ ██░░██ ████
████ ████████▒▒██▒▒▒▒▒▒▒▒██ ██░░▒▒▒▒░░██▒▒▓▓████░░████▒▒▓▓██
████████▒▒▒▒██▒▒██▒▒░░▒▒██░░██░░▒▒▒▒▒▒░░██▓▓▓▓██ ██ ██▓▓▓▓██
██▒▒██▒▒██▒▒██▓▓██▒▒██████████░░████████▒▒██▓▓▓▓▓▓██ ██▓▓▓▓▓▓██
████▒▒██▒▒██████▒▒████████████░░ ██████▒▒▒▒██▓▓▓▓▓▓▓▓▓▓▓▓▓▓██
██████████████▒▒████▒▒██▒▒████████▒▒██ ████░░██████████████
████▒▒██▒▒██▒▒██▒▒░░██▒▒▒▒▒▒▒▒▒▒░░██ ██▒▒░░██▓▓▓▓██
██▒▒██▒▒████▒▒██▒▒░░██▒▒▒▒░░▒▒▒▒░░▒▒██ ████░░██▒▒▒▒▓▓
██ ██████▒▒██████▒▒░░▒▒░░▒▒▒▒░░░░██ ██▒▒██▒▒▒▒▓▓
████████▒▒██ ░░░░▒▒░░▒▒▒▒░░░░▒▒██ ██████▓▓▒▒▓▓
██▒▒▒▒██ ████▒▒░░░░▒▒▒▒▒▒██████ ██░░██▓▓██
████ ██▒▒████▒▒▒▒▒▒██▒▒▒▒██ ██████
██▒▒ ▒▒▒▒████████ ██ ██▓▓▓▓██
██▒▒ ▒▒██ ▒▒ ▒▒██ ████
██▒▒▒▒▒▒██ ██▒▒▒▒▒▒████
████████████ ██████████████
██▒▒██░░░░▒▒██ ██░░░░██▒▒░░██
██▒▒██░░▒▒████ ██▒▒░░████▒▒██
██████████████ ██████████████
████▓▓▓▓████████ ██████▓▓▓▓████
██████████████████ ████████████
██▓▓░░░░▓▓████████ ████▓▓░░░░▓▓██
████▓▓▓▓██████████ ██████▓▓▓▓████
██████████████████ ████████████
The index.html file has everything you need to get started, just add your js sprig game in the following segment replacing my game:
If you get lost, check how I implemented my game inside the index.html file!
<!-- The Sprig device's aspect ratio is 5:4 -->
<canvas width="500" height="400" id="canvas" tabindex="0"></canvas>
<script type="module">
import { webEngine } from "https://esm.sh/sprig@1/web"
function runGame(api) {
// Your game code here.
}
const game = webEngine(document.getElementById("canvas"))
runGame(game.api)
</script>
Remember, to make a Sprig game you'll need to use Sprig's Web Editor.