Arranquem!
This commit is contained in:
143
data/intro.lua
Normal file
143
data/intro.lua
Normal file
@@ -0,0 +1,143 @@
|
||||
require "fps"
|
||||
|
||||
require "fade"
|
||||
|
||||
|
||||
-- require "game"
|
||||
-- require "mapa"
|
||||
-- require "scenes"
|
||||
|
||||
local arcade_config = require("arcade_config")
|
||||
o2aX = arcade_config.org2arc_escala
|
||||
|
||||
intro_wait=40
|
||||
intro_step=0
|
||||
|
||||
function intro_init()
|
||||
game_update = intro_intro
|
||||
intro_wait=400
|
||||
surf.cls(16)
|
||||
|
||||
surf.target(logo)
|
||||
surf.cls(16)
|
||||
draw.text("INTRO_INIT",0,0,15)
|
||||
surf.target(0)
|
||||
surf.source(logo)
|
||||
draw.surf(0,0,36,5,56,70,arcade_config.logo_sf.width,arcade_config.logo_sf.height)
|
||||
|
||||
-- surf.source(tiles)
|
||||
-- fade.fadein()
|
||||
end
|
||||
|
||||
function intro_intro()
|
||||
-- text("presenta",48,50,14)
|
||||
|
||||
intro_wait=intro_wait-1
|
||||
if intro_wait==0 or key.press(key.ESCAPE) or key.press(keyShoot) or pad.press(btnShoot) or pad.press(btnPause) then
|
||||
intro_wait=1
|
||||
-- game_update = intro_update
|
||||
game_update = print_fps
|
||||
fade.fadeoutin()
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function draw_item_intro( name, flip )
|
||||
local cw = arcade_config.character_width
|
||||
local ch = arcade_config.character_height
|
||||
if ( name == "abad" ) then
|
||||
draw.surf(0,0,cw,ch,44*o2aX,24*o2aX,cw,ch,flip)
|
||||
elseif (name == "batman" ) then
|
||||
draw.surf(0,48*o2aX,cw,ch,82*o2aX,24*o2aX,cw,ch,flip)
|
||||
elseif (name == "cacaus" ) then
|
||||
draw.surf(112*o2aX,88*o2aX,cw,ch/2,76*o2aX,32*o2aX,cw,ch/2,flip)
|
||||
elseif (name == "marc" ) then
|
||||
draw.rect(15*o2aX,3*o2aX,99*o2aX,51*o2aX,2)
|
||||
elseif (name == "pas porta" ) then
|
||||
draw.rectf(73*o2aX,24*o2aX,7*o2aX,16*o2aX,16)
|
||||
end
|
||||
end
|
||||
|
||||
function draw_escenari ()
|
||||
surf.cls(16)
|
||||
draw_item_intro("marc",false)
|
||||
view.origin(16*o2aX,4*o2aX)
|
||||
mapa_draw(10)
|
||||
-- Borrar la porta del mapa
|
||||
draw_item_intro("pas porta")
|
||||
end
|
||||
|
||||
function print_fps ()
|
||||
print("IN")
|
||||
local current_fps = frame()
|
||||
surf.cls(16)
|
||||
surf.target(logo)
|
||||
surf.cls(16)
|
||||
draw.text(current_fps.."fps",0,0,15)
|
||||
surf.target(0)
|
||||
surf.source(logo)
|
||||
draw.surf(0,0,36,5,56,70,arcade_config.logo_sf.width,arcade_config.logo_sf.height)
|
||||
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
|
||||
-- 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
|
||||
-- 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
|
||||
-- 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
|
||||
-- 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
|
||||
Reference in New Issue
Block a user