diff options
author | Lucas Fryzek <lucas.fryzek@fryzekconcepts.com> | 2025-03-20 21:38:04 +0000 |
---|---|---|
committer | Lucas Fryzek <lucas.fryzek@fryzekconcepts.com> | 2025-03-20 21:38:04 +0000 |
commit | 555e6dd5d35a715923a227842e251bd225607504 (patch) | |
tree | 69c90ce9d85b4c2b4ebe9c762193395f1f3b314b | |
parent | e4c4ec67e975b8668112e09be5bcea9cff8f5f89 (diff) |
Use enum for direction
-rw-r--r-- | world.rhm | 14 |
1 files changed, 12 insertions, 2 deletions
@@ -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): |