- Reestructuració completa
This commit is contained in:
19
data/modules/ia/torxa.lua
Normal file
19
data/modules/ia/torxa.lua
Normal file
@@ -0,0 +1,19 @@
|
||||
|
||||
function ia.update_torxa(spr)
|
||||
if spr.state == templates.ALIVE then
|
||||
if sprites.hero.lives == 4 then return end
|
||||
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
|
||||
sprites.hero.hit(4)
|
||||
spr.state = templates.DYING
|
||||
spr.timer = 0
|
||||
return
|
||||
end
|
||||
elseif spr.state == templates.DYING then
|
||||
spr.timer = spr.timer + 1
|
||||
if spr.timer == 32 then
|
||||
spr.state = templates.ALIVE
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user