A Go version of the https://lcthw.dev/learn-code-the-hard-way/curseyou-python-rogue that makes a tiny Rogue in Go.
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
399 B
20 lines
399 B
1 day ago
|
--- 01_the_screen/game.go 2025-10-06 10:40:36.384247800 -0400
|
||
|
+++ 02_mazes_and_enemies/game.go 2025-10-06 10:40:37.923662000 -0400
|
||
|
@@ -3,4 +3,5 @@
|
||
|
import (
|
||
|
"os"
|
||
|
+ "math/rand"
|
||
|
)
|
||
|
|
||
|
@@ -24,2 +25,10 @@
|
||
|
os.Exit(0)
|
||
|
}
|
||
|
+
|
||
|
+func (game *Game) PlaceEnemies(places []Position) {
|
||
|
+ for _, pos := range places {
|
||
|
+ if rand.Int() % 2 == 0 {
|
||
|
+ game.Enemies[pos] = &Enemy{10, pos, 4}
|
||
|
+ }
|
||
|
+ }
|
||
|
+}
|