diff options
Diffstat (limited to 'main.rhm')
-rw-r--r-- | main.rhm | 24 |
1 files changed, 16 insertions, 8 deletions
@@ -7,9 +7,11 @@ fun test(test_result :: Boolean, test_str :: String): | println("Passed " +& test_str) | println("Failed " +& test_str) -fun reset_entity(entity :: world.Entity): - entity.x := 0 - entity.y := 0 +fun +| reset_entity(entity :: world.Entity): reset_entity(entity, 0, 0) +| reset_entity(entity :: world.Entity, x :: Int, y :: Int): + entity.x := x + entity.y := y let wrld = world.World() let chunk = world.Chunk(64, 64, 0, 0) @@ -19,19 +21,25 @@ wrld.entities.add(entity) reset_entity(entity) -test(wrld.entity_move(0, 1, 0), "move horizontal") +test(entity.move(1, 0), "move horizontal") reset_entity(entity) -test(wrld.entity_move(0, 0, 1), "move vertical") +test(entity.move(0, 1), "move vertical") reset_entity(entity) -test(wrld.entity_move(0, 1, 1), "move diagonal") +test(entity.move(1, 1), "move diagonal") reset_entity(entity) -test(!wrld.entity_move(0, 2, 0), "move diagonal") +test(!entity.move(2, 0), "move diagonal") reset_entity(entity) -test(!wrld.entity_move(0, 0, 0), "starting pos") +test(!entity.move(0, 0), "starting pos") + +let new_chunk = world.Chunk(64, 64, 1, 0) +chunk.add_neighbour(new_chunk, #'east) +reset_entity(entity, 63, 0) +test(entity.move(64, 0), "cross chunk") +test(entity.current_chunk == new_chunk, "changed chunk") //world.entities println(@str{Entity is @(entity.x) @(entity.y)}) |