diff options
author | Steph Enders <smenders@gmail.com> | 2022-12-15 22:37:34 -0500 |
---|---|---|
committer | Steph Enders <smenders@gmail.com> | 2022-12-15 22:40:52 -0500 |
commit | da3922f1aa532b628693f5093f464d263831b153 (patch) | |
tree | c31a46780d56a5f574f2829d6742e4c01a57c160 /dnglib/defaults.lua | |
parent | b0cf4cb8818c8440462e24c7b553bc4b90b3a8a2 (diff) |
Disable enemy movement through enemies or treasure
Diffstat (limited to 'dnglib/defaults.lua')
-rw-r--r-- | dnglib/defaults.lua | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/dnglib/defaults.lua b/dnglib/defaults.lua index 77f688c..5b1c7c5 100644 --- a/dnglib/defaults.lua +++ b/dnglib/defaults.lua @@ -98,6 +98,9 @@ function onUpdate(dt) player = c_get_player_position() assert(type(player) == "table", "Player is not a table") + + treasures = c_get_treasures() + assert(type(treasures) == "table", "treasures is not a table") map = c_get_map(); assert(type(map) == "table", "map is not a table") @@ -105,10 +108,11 @@ function onUpdate(dt) for _, v in ipairs(enemies) do local next; if diff_time >= MOV_TIME then - next = algs.pathfind(v, player, map) + next = algs.pathfind(v, player, enemies, treasures, map) else next = { dx = 0, dy = 0 } end + new_pos = c_move_enemy(v.id, next.dx, next.dy) assert(type(new_pos) == "table", "new_pos is not a table") if new_pos.x == player.x and new_pos.y == player.y then |