Files
paku/data/modules/ia/clau.lua
T
2026-09-30 12:58:48 +02:00

16 lines
528 B
Lua

function ia.update_clau(spr)
if spr.state == templates.ALIVE then
local x1,y1,w1,h1 = util.aabb(spr)
local x2,y2,w2,h2 = util.aabb(sprites.hero)
if util.check_aabb_collision(x1,y1,w1,h1, x2,y2,w2,h2) then
if sprites.hero.give_key(spr.color) then
local tx, ty = sprites.get_tile(spr.pos.x), sprites.get_tile(spr.pos.y)
map.surf(rooms.surf_items)
map.tile(tx,ty,0)
sprites.remove(spr)
end
end
end
end