Files
paku/data/modules/ia/porta.lua
T
Raimon @ quifisraimon d2ebbccbf6 - [NEW] El mono
- [NEW] Noves animacions de detallets
- [NEW] Més particles i eye candy
- [FIX] Si es ficava un item/enemic en la fila de baix del tot no es guardaba
- [FIX] Quan se disaparaba cap a la dreta amb el final de la pantalla o una pared en la esquena, la bala no eixia
- [WIP] Treballant en el marcador
2026-10-06 15:56:37 +02:00

31 lines
1.1 KiB
Lua

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
spr.last_frame=0
end
end
elseif spr.state == templates.DYING then
if spr.current_frame ~= spr.last_frame then
spr.last_frame = spr.current_frame
sprites.dust_ex(spr, {pos={x=spr.pos.x+1, y=spr.pos.y+16-spr.last_frame}, dir={x=math.random()-0.5,y=0.9}, flipped=spr.flipped})
end
if spr.current_frame == 15 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)
map.surf(rooms.surf_foreground)
map.tile(tx,ty,0)
map.tile(tx,ty+1,0)
sprites.remove(spr)
end
end
end