[ENH] Tile de botella
[NEW] Indicacions per a anar a la mansió de Batman al obrir totes les portes
This commit is contained in:
+75
-70
@@ -29,6 +29,7 @@ require "tiles_layer2"
|
||||
require "batvio"
|
||||
-- require "live_scene"
|
||||
require "copter"
|
||||
require "sign"
|
||||
|
||||
local DEBUG = false
|
||||
|
||||
@@ -153,6 +154,10 @@ function load_stage()
|
||||
if stage_init then
|
||||
stage_init()
|
||||
stage_loaded = stage
|
||||
stage_update = stages["stage"..stage.."_update"]
|
||||
stage_draw_back = stages["stage"..stage.."_draw_back"]
|
||||
stage_draw_middle = stages["stage"..stage.."_draw_middle"]
|
||||
stage_draw_front = stages["stage"..stage.."_draw_front"]
|
||||
print("Stage "..stage.." loaded")
|
||||
else
|
||||
print("No se ha cargado la fase "..stage)
|
||||
@@ -294,76 +299,76 @@ function update_game()
|
||||
end
|
||||
end
|
||||
|
||||
function pause()
|
||||
print("pause()")
|
||||
-- surf.source(0)
|
||||
-- surf.target(back)
|
||||
-- draw.surf(0,0,128,96,0,0)
|
||||
-- surf.target(0)
|
||||
-- surf.source(tiles)
|
||||
-- pausa_option=1
|
||||
-- pause_old_update=game_update
|
||||
-- game_update=update_pause
|
||||
end
|
||||
|
||||
function update_pause()
|
||||
draw.rectf(16,16,97,65,16)
|
||||
draw.rect(16,16,97,65,15)
|
||||
draw.text("PAUSA",54,20,15)
|
||||
|
||||
menu_count=menu_count+1
|
||||
local parpadeig=false
|
||||
if menu_count>=20 then
|
||||
parpadeig=true
|
||||
if menu_count>40 then menu_count=0 end
|
||||
end
|
||||
draw.rect(28,33+(10*(pausa_option-1)),73,9,14)
|
||||
if (not parpadeig) then draw.rect(28,33+(10*(pausa_option-1)),73,9,13) end
|
||||
|
||||
--draw.rect(28,33+(10*(pausa_option-1)),73,9,13)
|
||||
|
||||
draw.text("CONTINUAR",30,35,14)
|
||||
draw.text("MUSICA:",30,45,14)
|
||||
if music.enabled() then
|
||||
draw.text("SI",91,45,15)
|
||||
else
|
||||
draw.text("NO",91,45,15)
|
||||
end
|
||||
draw.text("SÓ:",30,55,14)
|
||||
if sound.enabled() then
|
||||
draw.text("SI",91,55,15)
|
||||
else
|
||||
draw.text("NO",91,55,15)
|
||||
end
|
||||
draw.text("EIXIR",30,65,14)
|
||||
|
||||
if key.press(key.ESCAPE) then
|
||||
surf.source(back)
|
||||
draw.surf(0,0,128,96,0,0)
|
||||
surf.source(tiles)
|
||||
game_update = pause_old_update
|
||||
elseif key.press(keyDown) or pad.press(btnDown) then
|
||||
pausa_option = pausa_option + 1
|
||||
if pausa_option == 5 then pausa_option = 1 end
|
||||
elseif key.press(keyUp) or pad.press(btnUp) then
|
||||
pausa_option = pausa_option - 1
|
||||
if pausa_option == 0 then pausa_option = 4 end
|
||||
elseif key.press(keyShoot) or pad.press(btnShoot) then
|
||||
if pausa_option==1 then
|
||||
surf.source(back)
|
||||
draw.surf(0,0,128,96,0,0)
|
||||
surf.source(tiles)
|
||||
game_update = pause_old_update
|
||||
elseif pausa_option==2 then
|
||||
music.enabled(not music.enabled())
|
||||
elseif pausa_option==3 then
|
||||
sound.enabled(not sound.enabled())
|
||||
else
|
||||
game_exit()
|
||||
game_init(true)
|
||||
end
|
||||
end
|
||||
end
|
||||
-- function pause()
|
||||
-- print("pause()")
|
||||
-- -- surf.source(0)
|
||||
-- -- surf.target(back)
|
||||
-- -- draw.surf(0,0,128,96,0,0)
|
||||
-- -- surf.target(0)
|
||||
-- -- surf.source(tiles)
|
||||
-- -- pausa_option=1
|
||||
-- -- pause_old_update=game_update
|
||||
-- -- game_update=update_pause
|
||||
-- end
|
||||
--
|
||||
-- function update_pause()
|
||||
-- draw.rectf(16,16,97,65,16)
|
||||
-- draw.rect(16,16,97,65,15)
|
||||
-- draw.text("PAUSA",54,20,15)
|
||||
--
|
||||
-- menu_count=menu_count+1
|
||||
-- local parpadeig=false
|
||||
-- if menu_count>=20 then
|
||||
-- parpadeig=true
|
||||
-- if menu_count>40 then menu_count=0 end
|
||||
-- end
|
||||
-- draw.rect(28,33+(10*(pausa_option-1)),73,9,14)
|
||||
-- if (not parpadeig) then draw.rect(28,33+(10*(pausa_option-1)),73,9,13) end
|
||||
--
|
||||
-- --draw.rect(28,33+(10*(pausa_option-1)),73,9,13)
|
||||
--
|
||||
-- draw.text("CONTINUAR",30,35,14)
|
||||
-- draw.text("MUSICA:",30,45,14)
|
||||
-- if music.enabled() then
|
||||
-- draw.text("SI",91,45,15)
|
||||
-- else
|
||||
-- draw.text("NO",91,45,15)
|
||||
-- end
|
||||
-- draw.text("SÓ:",30,55,14)
|
||||
-- if sound.enabled() then
|
||||
-- draw.text("SI",91,55,15)
|
||||
-- else
|
||||
-- draw.text("NO",91,55,15)
|
||||
-- end
|
||||
-- draw.text("EIXIR",30,65,14)
|
||||
--
|
||||
-- if key.press(key.ESCAPE) then
|
||||
-- surf.source(back)
|
||||
-- draw.surf(0,0,128,96,0,0)
|
||||
-- surf.source(tiles)
|
||||
-- game_update = pause_old_update
|
||||
-- elseif key.press(keyDown) or pad.press(btnDown) then
|
||||
-- pausa_option = pausa_option + 1
|
||||
-- if pausa_option == 5 then pausa_option = 1 end
|
||||
-- elseif key.press(keyUp) or pad.press(btnUp) then
|
||||
-- pausa_option = pausa_option - 1
|
||||
-- if pausa_option == 0 then pausa_option = 4 end
|
||||
-- elseif key.press(keyShoot) or pad.press(btnShoot) then
|
||||
-- if pausa_option==1 then
|
||||
-- surf.source(back)
|
||||
-- draw.surf(0,0,128,96,0,0)
|
||||
-- surf.source(tiles)
|
||||
-- game_update = pause_old_update
|
||||
-- elseif pausa_option==2 then
|
||||
-- music.enabled(not music.enabled())
|
||||
-- elseif pausa_option==3 then
|
||||
-- sound.enabled(not sound.enabled())
|
||||
-- else
|
||||
-- game_exit()
|
||||
-- game_init(true)
|
||||
-- end
|
||||
-- end
|
||||
-- end
|
||||
|
||||
function print_analisis_field ( field )
|
||||
local field_state=" "
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
sign={}
|
||||
|
||||
function sign.new(_hab, _x, _y, _angle,_flip)
|
||||
local world_x, world_y = coords.room_to_world(_hab,_x,_y)
|
||||
return {name="sign",
|
||||
hab=_hab,
|
||||
x=world_x,
|
||||
y=world_y,
|
||||
w=16,
|
||||
h=16,
|
||||
flip=_flip,
|
||||
--frame=19,
|
||||
wait=0,
|
||||
step=0,
|
||||
can_warp=false,
|
||||
warping=false,
|
||||
shrink=1,
|
||||
d_shrink=1,
|
||||
angle=_angle,
|
||||
d_angle=0,
|
||||
--hit=sign.hit,
|
||||
update=sign.update,
|
||||
draw=sign.draw,
|
||||
--jumpfwd=false,
|
||||
--dying=false,
|
||||
--death_time=40,
|
||||
--anim={19,19,20,21},
|
||||
bb={x=0,y=0,w=16,h=16},
|
||||
enabled= true,
|
||||
disable_reason="" }
|
||||
end
|
||||
|
||||
function sign:draw()
|
||||
if not self.enabled then return end
|
||||
local scr_x, scr_y = viewp:screen_coords( self.x, self.y )
|
||||
draw.surf(240,224,self.w,self.h,scr_x,scr_y,self.w,self.h,self.flip)
|
||||
end
|
||||
|
||||
function sign:update()
|
||||
self.wait = (self.wait + 1) % 18
|
||||
if (self.wait==0) then
|
||||
self.enabled = not self.enabled
|
||||
end
|
||||
end
|
||||
@@ -1,15 +1,18 @@
|
||||
stages = {}
|
||||
|
||||
stages.actors={}
|
||||
stages.boss_loaded = false
|
||||
stages.boss_ready = false
|
||||
stages.boss_finished = false
|
||||
boss = nil
|
||||
|
||||
function stages.stage1_init()
|
||||
stages.actors={}
|
||||
mapa = stage1_mapa
|
||||
tiletype={void=0,nonpc=1,stair=2,switch=3,half=4,block=5}
|
||||
mapa.wait=0
|
||||
mapa.step=0
|
||||
mapa.tobatcave = false
|
||||
load_tilemap( sf_mapa )
|
||||
|
||||
llibre.init()
|
||||
@@ -179,6 +182,8 @@ function stages.stage1_init()
|
||||
tiles_layer2.new(76,3,2,128,208,16,16, tiles_layer2.update_aranya, tiles_layer2.draw_aranya)
|
||||
tiles_layer2.new(78,6,2,128,208,16,16, tiles_layer2.update_aranya, tiles_layer2.draw_aranya)
|
||||
|
||||
-- table.insert( actors, sign.new(10, 6 , 3, 0, false) ) -- L
|
||||
|
||||
local abad_x, abad_y = coords.room_to_world ( 10, 4, 3 )
|
||||
-- local abad_x, abad_y = coords.room_to_world ( 54, 8, 3 )
|
||||
-- table.insert( actors, trigger.new(8,4,3,triggers.escena_stage1_ending,"stage1 ending","TR09") )
|
||||
@@ -197,6 +202,32 @@ function stages.stage1_init()
|
||||
stages.boss_loaded = false
|
||||
end
|
||||
|
||||
function stages.stage1_toBatcave()
|
||||
local switches_enabled = 0
|
||||
|
||||
if mapa.tobatcave then return end
|
||||
|
||||
for key,actor in pairs(actors) do
|
||||
if actor.type=="switch" and actor.enabled then
|
||||
switches_enabled = switches_enabled +1
|
||||
end
|
||||
end
|
||||
|
||||
if switches_enabled<=2 then
|
||||
mapa.tobatcave = true
|
||||
table.insert( stages.actors, sign.new(76, 8 , 1, 0, true) ) -- L
|
||||
table.insert( stages.actors, sign.new(73, 10, 3, 0, true) ) -- L
|
||||
table.insert( stages.actors, sign.new(72, 5 , 1, 0, true) ) -- L
|
||||
-- table.insert( stages.actors, sign.new(61, 6 , 1, 0, true) ) -- L
|
||||
-- table.insert( stages.actors, sign.new(50, 9 , 1, 0, true) ) -- L
|
||||
table.insert( stages.actors, sign.new(41, 5, 3, 0, false) ) -- R
|
||||
-- table.insert( actors, sign.new(40, 10, 3, 0, false) ) -- R
|
||||
-- table.insert( actors, sign.new(42, 1 , 2, 90, false) ) -- D
|
||||
table.insert( stages.actors, sign.new(53, 4 , 3, 0, false) ) -- R
|
||||
print("GO TO BATCAVE")
|
||||
end
|
||||
end
|
||||
|
||||
function stages.stage1_update()
|
||||
-- print("stage1_update")
|
||||
-- fireball.update()
|
||||
@@ -204,10 +235,21 @@ function stages.stage1_update()
|
||||
-- -- Requeriment: tindre mitja clau
|
||||
-- premiere.healer_init()
|
||||
-- end
|
||||
stages.stage1_toBatcave()
|
||||
for key,actor in pairs(stages.actors) do
|
||||
if viewp:inside(actor.x, actor.y, actor.w, actor.h) and actor~=abad then
|
||||
actor:update()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function stages.stage1_draw_back()
|
||||
-- print("stage1_draw_back")
|
||||
for key,actor in pairs(stages.actors) do
|
||||
if viewp:inside(actor.x, actor.y, actor.w, actor.h) and actor~=abad then
|
||||
actor:draw()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function stages.stage1_draw_middle()
|
||||
|
||||
@@ -86,7 +86,7 @@ end
|
||||
|
||||
function stages.stage1_boss_intro_update()
|
||||
if stage1_boss.time==0 then
|
||||
-- start_scene(scenes.lluita_imp, nil, false)
|
||||
start_scene(scenes.lluita_imp, nil, false)
|
||||
stages.stage1_boss_ready()
|
||||
end
|
||||
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
Reference in New Issue
Block a user