About Social Code
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLucas Fryzek <lucas.fryzek@fryzekconcepts.com>2025-03-20 21:38:04 +0000
committerLucas Fryzek <lucas.fryzek@fryzekconcepts.com>2025-03-20 21:38:04 +0000
commit555e6dd5d35a715923a227842e251bd225607504 (patch)
tree69c90ce9d85b4c2b4ebe9c762193395f1f3b314b
parente4c4ec67e975b8668112e09be5bcea9cff8f5f89 (diff)
Use enum for direction
-rw-r--r--world.rhm14
1 files changed, 12 insertions, 2 deletions
diff --git a/world.rhm b/world.rhm
index 3a5515a..6adfd02 100644
--- a/world.rhm
+++ b/world.rhm
@@ -5,16 +5,26 @@ export:
Entity
World
+enum Direction:
+ north
+ north_east
+ east
+ south_east
+ south
+ south_west
+ west
+ north_west
+
class Chunk(width :: Int,
height :: Int,
offset_x :: Int,
offset_y :: Int,
tiles :: Array.now_of(Int),
- neighbours :: MutableMap.now_of(Symbol, Chunk)):
+ neighbours :: MutableMap.now_of(Direction, Chunk)):
constructor(width :: Int, height :: Int, offset_x :: Int, offset_y :: Int):
super(width, height, offset_x, offset_y, Array.make(width * height, 0), MutableMap())
- method add_neighbour(chunk :: Chunk, direction :: Symbol):
+ method add_neighbour(chunk :: Chunk, direction :: Direction):
neighbours[direction] := chunk
method get_tile(x :: Int, y :: Int):