120 lines
3.3 KiB
Lua
120 lines
3.3 KiB
Lua
local abad={x=0,y=0,w=32,h=32,dx=88,dy=48,dw=32,dh=32}
|
|
local batman={x=0,y=96,w=32,h=32,dx=164,dy=48,dw=32,dh=32}
|
|
local cacaus={x=224,y=176,w=32,h=16,dx=152,dy=64,dw=32,dh=16}
|
|
local marc={x=30,y=6,w=198,h=102,color=2}
|
|
local pas_porta={x=146,y=48,w=14,h=32,color=16}
|
|
local scene_x_offset = 32
|
|
local scene_y_offset = 8
|
|
|
|
intro_wait=40
|
|
intro_step=0
|
|
|
|
function draw_escenari ()
|
|
surf.cls(16)
|
|
draw_item_intro("marc",false)
|
|
view.origin(scene_x_offset, scene_y_offset)
|
|
mapa_draw(10)
|
|
-- Borrar la porta del mapa
|
|
draw_item_intro("pas porta")
|
|
end
|
|
|
|
function draw_item_intro( name, flip )
|
|
if ( name == "abad" ) then
|
|
draw.surf(abad.x, abad.y, abad.w, abad.h, abad.dx, abad.dy, abad.dw, abad.dh, flip)
|
|
elseif (name == "batman" ) then
|
|
draw.surf(batman.x, batman.y, batman.w, batman.h, batman.dx, batman.dy, batman.dw, batman.dh, flip)
|
|
elseif (name == "cacaus" ) then
|
|
draw.surf(cacaus.x, cacaus.y, cacaus.w, cacaus.h, cacaus.dx, cacaus.dy, cacaus.dw, cacaus.dh, flip)
|
|
elseif (name == "marc" ) then
|
|
draw.rect(marc.x, marc.y, marc.w, marc.h, marc.color)
|
|
elseif (name == "pas porta" ) then
|
|
draw.rectf(pas_porta.x, pas_porta.y, pas_porta.w, pas_porta.h, pas_porta.color)
|
|
end
|
|
end
|
|
|
|
function intro_init()
|
|
game_update = intro_intro
|
|
intro_wait=400
|
|
surf.source(tiles)
|
|
surf.target(0)
|
|
surf.cls(16)
|
|
fade.fadein()
|
|
font.current(font_sf)
|
|
end
|
|
|
|
function intro_intro()
|
|
intro_wait=1
|
|
game_update = intro_update
|
|
fade.fadeoutin()
|
|
end
|
|
|
|
function intro_update()
|
|
|
|
if key.press(key.ESCAPE) or pad.press(btnPause) then
|
|
game_init(true)
|
|
fade.fadeoutin()
|
|
elseif key.press(key.SPACE) then
|
|
intro_wait=1
|
|
end
|
|
|
|
intro_wait=intro_wait-1
|
|
if intro_wait==0 then
|
|
-- == INTRO_01
|
|
-- STEP 0
|
|
if intro_step==0 then
|
|
draw_escenari()
|
|
draw_item_intro("abad", true)
|
|
view.origin(0,0)
|
|
intro_step=intro_step+1
|
|
-- STEP 1
|
|
elseif intro_step==1 then
|
|
start_scene(scenes.intro_01,58)
|
|
intro_step=intro_step+1
|
|
|
|
-- == INTRO_02
|
|
-- STEP 2
|
|
elseif intro_step==2 then
|
|
draw_escenari()
|
|
draw_item_intro("abad", false)
|
|
view.origin(0,0)
|
|
intro_step=intro_step+1
|
|
-- STEP 3
|
|
elseif intro_step==3 then
|
|
start_scene(scenes.intro_02,58)
|
|
intro_step=intro_step+1
|
|
|
|
-- == INTRO_03
|
|
-- STEP 4
|
|
elseif intro_step==4 then
|
|
draw_escenari()
|
|
draw_item_intro("abad", false)
|
|
draw_item_intro("cacaus", true)
|
|
draw_item_intro("batman", true)
|
|
view.origin(0,0)
|
|
intro_step=intro_step+1
|
|
-- STEP 5
|
|
elseif intro_step==5 then
|
|
start_scene(scenes.intro_03,58)
|
|
intro_step=intro_step+1
|
|
|
|
-- == INTRO_04
|
|
-- STEP 6
|
|
elseif intro_step==6 then
|
|
draw_escenari()
|
|
draw_item_intro("abad", false)
|
|
view.origin(0,0)
|
|
intro_step=intro_step+1
|
|
-- STEP 7
|
|
elseif intro_step==7 then
|
|
start_scene(scenes.intro_04,58)
|
|
intro_step=intro_step+1
|
|
|
|
-- STEP 8
|
|
elseif intro_step==8 then
|
|
music.play(audio_main_song)
|
|
game_init(true)
|
|
fade.fadeoutin()
|
|
end
|
|
intro_wait=50
|
|
end
|
|
end |