diff --git a/gameloop.sql b/gameloop.sql index f0d1f85..83cdbf2 100644 --- a/gameloop.sql +++ b/gameloop.sql @@ -90,7 +90,7 @@ BEGIN TRANSACTION; UPDATE mobs SET x = x + cos(dir) * 0.5, y = y + sin(dir) * 0.5 WHERE kind = 'bullet'; -- Delete bullets that are out of bounds -DELETE FROM mobs WHERE x < 0 OR x >= (select max(x) from map) OR y < 0 OR y >= (select max(y) from map) AND kind = 'bullet'; +DELETE FROM mobs WHERE (x < 0 OR x >= (select max(x) from map) OR y < 0 OR y >= (select max(y) from map)) AND kind = 'bullet'; -- Delete bullets that hit walls DELETE FROM mobs b WHERE EXISTS (SELECT 1 FROM map m WHERE m.x = CAST(b.x AS INT) AND m.y = CAST(b.y AS INT) AND m.tile = '#') AND kind = 'bullet';