- Reset game on death

This commit is contained in:
2022-11-02 18:59:53 +01:00
parent 697edf14e3
commit cd054043dd

View File

@@ -24,6 +24,11 @@ function _init()
local pal=loadpal("tiles.gif") local pal=loadpal("tiles.gif")
setpal(pal) setpal(pal)
actors={}
cameras={}
camera_names={[0]="GPS","Gorro","Peu de Paco","Premiere","EL_ALIEN","BatMan"}
current_camera=0
-- ACTORS PRINCIPALS -- ACTORS PRINCIPALS
abad_init() abad_init()
table.insert(actors,abad) table.insert(actors,abad)
@@ -70,6 +75,7 @@ function _init()
-- TRIGGERS -- TRIGGERS
table.insert(actors,trigger.new(10,44,32,triggers.escena_abad_inici)) table.insert(actors,trigger.new(10,44,32,triggers.escena_abad_inici))
table.insert(actors,trigger.new(11,16,32,triggers.escena_abad_corfes)) table.insert(actors,trigger.new(11,16,32,triggers.escena_abad_corfes))
table.insert(actors,trigger.new(19,32,32,triggers.escena_habitacio_batman))
score.create() score.create()
cameras[0]=gps cameras[0]=gps
@@ -242,6 +248,13 @@ function update_game()
end end
end end
function game_exit()
mapa_restore_backup()
freesurf(tiles)
actors={}
cameras={}
end
function aabb(a, b) function aabb(a, b)
return (a.x+a.bb.x+a.bb.w >= b.x+b.bb.x) and (a.x+a.bb.x <= b.x+b.bb.x+b.bb.w) and (a.y+a.bb.y+a.bb.h >= b.y+b.bb.y) and (a.y+a.bb.y <= b.y+b.bb.y+b.bb.h) return (a.x+a.bb.x+a.bb.w >= b.x+b.bb.x) and (a.x+a.bb.x <= b.x+b.bb.x+b.bb.w) and (a.y+a.bb.y+a.bb.h >= b.y+b.bb.y) and (a.y+a.bb.y <= b.y+b.bb.y+b.bb.h)
end end