diff --git a/site/docs/tutorials/snake/collision-detection.md b/site/docs/tutorials/snake/collision-detection.md index edb02ac1..480566db 100644 --- a/site/docs/tutorials/snake/collision-detection.md +++ b/site/docs/tutorials/snake/collision-detection.md @@ -727,7 +727,7 @@ What you do, is up to you. You could stop the game and show the score. Or you co ```zig pub fn isDead(this: *@This()) bool { const head = this.body.get(0); - for (this.body.constSlice()) |part, i| { + for (this.body.constSlice(), 0..) |part, i| { if (i == 0) continue; if (part.equals(head)) return true; } diff --git a/site/docs/tutorials/snake/goal.md b/site/docs/tutorials/snake/goal.md index 49434066..83240aad 100644 --- a/site/docs/tutorials/snake/goal.md +++ b/site/docs/tutorials/snake/goal.md @@ -1,10 +1,10 @@ # Inspiration & Goals -Snake is a simple game. You can implement it in pretty any language or engine. It also allows for real-time user interaction and is a challenging game in itself. +Snake is a simple game. You can implement it in pretty much any language or engine. It also allows for real-time user interaction and is a challenging game in itself. ## Goals -And the end of the tutorial, you will have a working version of snake. +At the end of the tutorial, you will have a working version of the game Snake. You can expand on it and make your very own version along the way. During this tutorial you will learn how to ... @@ -25,4 +25,4 @@ You'll find all completed implementations in the various languages. At the end of this tutorial, your snake game will look like this: -![Snake Preview](images/endresult.webp) \ No newline at end of file +![Snake Preview](images/endresult.webp) diff --git a/site/docs/tutorials/snake/handling-user-input.md b/site/docs/tutorials/snake/handling-user-input.md index a3930d2c..bfdd1876 100644 --- a/site/docs/tutorials/snake/handling-user-input.md +++ b/site/docs/tutorials/snake/handling-user-input.md @@ -10,7 +10,7 @@ But first, you need to understand how WASM-4 handles user input. ## Gamepad Basics -WASM-4 provides 4 variables that represent the current state of the respective gamepad. It's `0` (Zero) if nothing is pressed right now. Otherwise it contains a sum of those values: +WASM-4 accepts up to 4 gamepads and provides 4 variables that represent the current state of this gamepads. It contains a value `0` (zero) if nothing has been pressed; otherwise, it contains a sum of the buttons pressed, based on the table below: | Button | Value | |----------|:-----:| @@ -421,9 +421,9 @@ impl Game { ```zig export fn update() void { - frameCount++ + frame_count += 1; - if (frameCount % 15 == 0) { + if (frame_count % 15 == 0) { snake.update() }