- Reestructuració completa
This commit is contained in:
24
data/modules/ia/porta.lua
Normal file
24
data/modules/ia/porta.lua
Normal file
@@ -0,0 +1,24 @@
|
||||
|
||||
function ia.update_porta(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.keys[spr.color] then
|
||||
sprites.hero.keys[spr.color] = nil
|
||||
sprites.set_animation(spr, "porta_obrint")
|
||||
spr.state = templates.DYING
|
||||
end
|
||||
end
|
||||
elseif spr.state == templates.DYING then
|
||||
if spr.current_frame == 15 then
|
||||
local tx, ty = (spr.pos.x)>>3, (spr.pos.y)>>3
|
||||
map.surf(rooms.surf_items)
|
||||
map.tile(tx,ty,0)
|
||||
map.surf(rooms.surf_foreground)
|
||||
map.tile(tx,ty,0)
|
||||
map.tile(tx,ty+1,0)
|
||||
sprites.remove(spr)
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user