diff options
Diffstat (limited to 'main.rhm')
-rw-r--r-- | main.rhm | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/main.rhm b/main.rhm new file mode 100644 index 0000000..3ab966f --- /dev/null +++ b/main.rhm @@ -0,0 +1,39 @@ +#lang rhombus/static + +import "world.rhm" + +fun test(test_result :: Boolean, test_str :: String): + if test_result + | println("Passed " +& test_str) + | println("Failed " +& test_str) + +fun reset_entity(entity :: world.Entity): + entity.x := 0 + entity.y := 0 + +let wrld = world.World() +let chunk = world.Chunk(64, 64, 0, 0) +wrld.chunks.add(chunk) +let entity = world.Entity(0, 0, 0, chunk) +wrld.entities.add(entity) + + +reset_entity(entity) +test(wrld.entity_move(0, 1, 0), "move horizontal") + +reset_entity(entity) +test(wrld.entity_move(0, 0, 1), "move vertical") + +reset_entity(entity) +test(wrld.entity_move(0, 1, 1), "move diagonal") + +reset_entity(entity) +test(!wrld.entity_move(0, 2, 0), "move diagonal") + +reset_entity(entity) +test(!wrld.entity_move(0, 0, 0), "starting pos") + +//world.entities +println(@str{Entity is @(entity.x) @(entity.y)}) + + |