Skip to content

Commit 894973b

Browse files
committed
Update doc/enemies.adoc
1 parent 0463308 commit 894973b

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

doc/enemies.adoc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,27 +41,27 @@ Let's introduce two new functions in the `onFrame`-Function that will update `en
4141

4242
`updateEnemySpeed` will slowly increase `enemySpeed` over time starting with an initial value:
4343

44-
{% codesnippet "https://raw.githubusercontent.com/macrozone/elm-hexagon-tutorial/chapter/enemies/src/Hexagon.elm", lines="162:165", language="elm" %}{% endcodesnippet %}
44+
{% codesnippet "https://raw.githubusercontent.com/macrozone/elm-hexagon-tutorial/chapter/enemies/src/Hexagon.elm", lines="160:163", language="elm" %}{% endcodesnippet %}
4545

4646
`updateEnemies` is a little bit tricky. Let's first take a look at the whole function:
4747

48-
{% codesnippet "https://raw.githubusercontent.com/macrozone/elm-hexagon-tutorial/chapter/enemies/src/Hexagon.elm", lines="142:160", language="elm" %}{% endcodesnippet %}
48+
{% codesnippet "https://raw.githubusercontent.com/macrozone/elm-hexagon-tutorial/chapter/enemies/src/Hexagon.elm", lines="140:158", language="elm" %}{% endcodesnippet %}
4949

5050
The enemies will approach the player over time. We represent this as the `enemyProgress`:
5151

52-
{% codesnippet "https://raw.githubusercontent.com/macrozone/elm-hexagon-tutorial/chapter/enemies/src/Hexagon.elm", lines="145:145", language="elm" %}{% endcodesnippet %}
52+
{% codesnippet "https://raw.githubusercontent.com/macrozone/elm-hexagon-tutorial/chapter/enemies/src/Hexagon.elm", lines="143:143", language="elm" %}{% endcodesnippet %}
5353

5454
As we have only a fixed set of enemies, we need them to repeat after all have passed the player. We do this by defining a `maxDistance` that is the total radius of all enemies.
5555

56-
{% codesnippet "https://raw.githubusercontent.com/macrozone/elm-hexagon-tutorial/chapter/enemies/src/Hexagon.elm", lines="146:147", language="elm" %}{% endcodesnippet %}
56+
{% codesnippet "https://raw.githubusercontent.com/macrozone/elm-hexagon-tutorial/chapter/enemies/src/Hexagon.elm", lines="144:145", language="elm" %}{% endcodesnippet %}
5757

5858
The enemies should repeat whenever `enemyProgress` exceeds this `maxDistance`. You see this in `radiusFor` where we calculate the radius for every enemy modulo `maxDistance`:
5959

60-
{% codesnippet "https://raw.githubusercontent.com/macrozone/elm-hexagon-tutorial/chapter/enemies/src/Hexagon.elm", lines="152:154", language="elm" %}{% endcodesnippet %}
60+
{% codesnippet "https://raw.githubusercontent.com/macrozone/elm-hexagon-tutorial/chapter/enemies/src/Hexagon.elm", lines="150:152", language="elm" %}{% endcodesnippet %}
6161

6262
`offsetForEnemy` represents the distance for a single enemy.
6363

64-
{% codesnippet "https://raw.githubusercontent.com/macrozone/elm-hexagon-tutorial/chapter/enemies/src/Hexagon.elm", lines="149:150", language="elm" %}{% endcodesnippet %}
64+
{% codesnippet "https://raw.githubusercontent.com/macrozone/elm-hexagon-tutorial/chapter/enemies/src/Hexagon.elm", lines="147:148", language="elm" %}{% endcodesnippet %}
6565

6666
We subtract the `enemyProgress`, so that value will be negative (for most enemies). But because we take the modulo `maxDistance` of it, it will always be between 0 and `maxDistance` and will decrease for every enemy over time.
6767

0 commit comments

Comments
 (0)