- Primer 'redo' de part del codi
- Afegida la pantalla de titol
This commit is contained in:
158
data/logo.lua
158
data/logo.lua
@@ -4,6 +4,10 @@ local logo_anim={}
|
||||
local step1_finished = false
|
||||
local brillo_y = 10
|
||||
local logo_wait = 400
|
||||
local logo_sf = 99
|
||||
local font_sf = 99
|
||||
local logo_sf_w = 63
|
||||
local logo_sf_h = 30
|
||||
|
||||
function logo_anim_init ()
|
||||
logo_anim={ [1] = {x0=-126, y=80, w=126, h=4, speed= 1, accel= 0.25, x1=65, delay=0},
|
||||
@@ -13,43 +17,93 @@ function logo_anim_init ()
|
||||
[5] = {x0=-126, y=96, w=126, h=4, speed= 1, accel= 0.25, x1=65, delay=16}}
|
||||
end
|
||||
|
||||
function logo_init()
|
||||
game_update = logo_intro
|
||||
surf.cls(16)
|
||||
|
||||
local font_default = font.current()
|
||||
font.current(font_sf)
|
||||
surf.target(back)
|
||||
surf.cls(16)
|
||||
draw.text("JAILGAMES",0,0,15)
|
||||
draw.text("presenta",0,20,14)
|
||||
draw.text("JAILGAMES",0,40,2)
|
||||
font.current(font_default)
|
||||
surf.target(0)
|
||||
logo_anim_init()
|
||||
function logo_config(font_surface)
|
||||
font_sf = font_surface
|
||||
end
|
||||
|
||||
function logo_intro()
|
||||
logo_wait=logo_wait-1
|
||||
function logo_init()
|
||||
-- print("LOGO INIT")
|
||||
local font_default = font.current()
|
||||
-- Crear la surface
|
||||
logo_sf=surf.new(logo_sf_w,logo_sf_h)
|
||||
-- logo_sf=surf.new(256,192)
|
||||
-- Netejar el back
|
||||
surf.target(logo_sf)
|
||||
surf.cls(0)
|
||||
-- Font per a escriure
|
||||
font.current(font_sf)
|
||||
-- Logo
|
||||
draw.text("JAILGAMES",0,0,15)
|
||||
draw.text("presenta",0,10,14)
|
||||
draw.text("JAILGAMES",0,20,2)
|
||||
-- Restaurar font
|
||||
font.current(font_default)
|
||||
-- Inicialitzar animació
|
||||
logo_anim_init()
|
||||
flow:add_path({logo_animate, logo_end})
|
||||
|
||||
if logo_wait==0 or key.press(key.ESCAPE) or key.press(keyShoot) or pad.press(btnShoot) or pad.press(btnPause) then
|
||||
logo_wait=1
|
||||
game_update = logo_update
|
||||
fade.fadeoutin()
|
||||
end
|
||||
-- print("LOGO_ANIMATE= ")
|
||||
-- print(logo_animate)
|
||||
-- print("LOGO_END= ")
|
||||
-- print(logo_end)
|
||||
|
||||
surf.source(back)
|
||||
-- Següent bucle
|
||||
-- game_update = logo_intro
|
||||
flow:next()
|
||||
end
|
||||
|
||||
function logo_draw()
|
||||
-- print("LOGO DRAW "..logo_step)
|
||||
-- Seleccionar font i destí
|
||||
surf.source(logo_sf)
|
||||
surf.target(0)
|
||||
-- Netejar destí
|
||||
surf.cls(16)
|
||||
|
||||
-- Animació per a l'aparició del logo
|
||||
if logo_step==1 then
|
||||
-- Crear les barres
|
||||
draw.surf(0,0,63,2, logo_anim[1].x0,logo_anim[1].y,logo_anim[1].w,logo_anim[1].h)
|
||||
draw.surf(0,2,63,2, logo_anim[2].x0,logo_anim[2].y,logo_anim[2].w,logo_anim[2].h)
|
||||
draw.surf(0,4,63,2, logo_anim[3].x0,logo_anim[3].y,logo_anim[3].w,logo_anim[3].h)
|
||||
draw.surf(0,6,63,2, logo_anim[4].x0,logo_anim[4].y,logo_anim[4].w,logo_anim[4].h)
|
||||
draw.surf(0,8,63,2, logo_anim[5].x0,logo_anim[5].y,logo_anim[5].w,logo_anim[5].h)
|
||||
end
|
||||
|
||||
-- presenta
|
||||
if logo_step==2 then
|
||||
draw.surf(0,0,63,10, logo_anim[1].x0,logo_anim[1].y,logo_anim[1].w,logo_anim[1].h*5); -- JAILGAMES
|
||||
draw.surf(0,10,55,10, 100,102,55,10); -- presenta
|
||||
end
|
||||
|
||||
-- pausa
|
||||
if logo_step==3 then
|
||||
draw.surf(0,0,63,10, logo_anim[1].x0,logo_anim[1].y,logo_anim[1].w,logo_anim[1].h*5); -- JAILGAMES
|
||||
draw.surf(0,10,55,10, 100,102,55,10); -- presenta
|
||||
end
|
||||
|
||||
-- Brillo
|
||||
if logo_step==4 then
|
||||
draw.surf(0,0,63,10, logo_anim[1].x0,logo_anim[1].y,logo_anim[1].w,logo_anim[1].h*5); -- JAILGAMES
|
||||
draw.surf(0,10,55,10, 100,102,55,10); -- presenta
|
||||
|
||||
-- if logo_step_wait>=1 then
|
||||
draw.surf(0,20+math.floor(brillo_y),63,1,
|
||||
logo_anim[1].x0, logo_anim[1].y+math.floor(brillo_y*2), logo_anim[1].w, 1);
|
||||
-- end
|
||||
end
|
||||
|
||||
-- Final
|
||||
if logo_step>=5 then
|
||||
draw.surf(0,0,63,10, logo_anim[1].x0,logo_anim[1].y,logo_anim[1].w,logo_anim[1].h*5); -- JAILGAMES
|
||||
draw.surf(0,10,55,10, 100,102,55,10); -- presenta
|
||||
end
|
||||
end
|
||||
|
||||
function logo_update()
|
||||
-- print("LOGO UPDATE "..logo_step)
|
||||
-- Animació per a l'aparició del logo
|
||||
if logo_step==1 then
|
||||
step1_finished = true
|
||||
logo_step_wait = logo_step_wait+1
|
||||
if logo_step_wait>=1 then
|
||||
@@ -81,17 +135,10 @@ function logo_intro()
|
||||
end
|
||||
|
||||
-- presenta
|
||||
if logo_step==2 then
|
||||
-- draw.surf(0,0, 63,10, 65,80,126,20); -- JAILGAMES
|
||||
draw.surf(0,0,63,10, logo_anim[1].x0,logo_anim[1].y,logo_anim[1].w,logo_anim[1].h*5); -- JAILGAMES
|
||||
draw.surf(0,20,55,10, 100,102,55,10); -- presenta
|
||||
logo_step = 3
|
||||
end
|
||||
if logo_step==2 then logo_step = 3 end
|
||||
|
||||
-- pausa
|
||||
if logo_step==3 then
|
||||
draw.surf(0,0,63,10, logo_anim[1].x0,logo_anim[1].y,logo_anim[1].w,logo_anim[1].h*5); -- JAILGAMES
|
||||
draw.surf(0,20,55,10, 100,102,55,10); -- presenta
|
||||
logo_step_wait = logo_step_wait+1
|
||||
if logo_step_wait>=20 then
|
||||
logo_step_wait = 0
|
||||
@@ -101,30 +148,45 @@ function logo_intro()
|
||||
|
||||
-- Brillo
|
||||
if logo_step==4 then
|
||||
draw.surf(0,0,63,10, logo_anim[1].x0,logo_anim[1].y,logo_anim[1].w,logo_anim[1].h*5); -- JAILGAMES
|
||||
draw.surf(0,20,55,10, 100,102,55,10); -- presenta
|
||||
|
||||
logo_step_wait = logo_step_wait+1
|
||||
if logo_step_wait>=1 then
|
||||
if logo_step_wait>=2 then
|
||||
logo_step_wait = 0
|
||||
draw.surf(0,40+math.floor(brillo_y),63,1,
|
||||
logo_anim[1].x0, logo_anim[1].y+math.floor(brillo_y*2), logo_anim[1].w, 1);
|
||||
|
||||
brillo_y = brillo_y-0.5
|
||||
|
||||
if brillo_y==0 then logo_step = 5 end
|
||||
if brillo_y<0 then logo_step = 5 end
|
||||
end
|
||||
end
|
||||
|
||||
-- Final
|
||||
if logo_step>=5 then
|
||||
draw.surf(0,0,63,10, logo_anim[1].x0,logo_anim[1].y,logo_anim[1].w,logo_anim[1].h*5); -- JAILGAMES
|
||||
draw.surf(0,20,55,10, 100,102,55,10); -- presenta
|
||||
if logo_step==5 then logo_wait = 75 end
|
||||
-- Pausa final
|
||||
if logo_step==5 then
|
||||
logo_step = 6
|
||||
end
|
||||
logo_wait = 75
|
||||
end
|
||||
|
||||
-- Final
|
||||
if logo_step==6 and logo_wait==0 then logo_step = 7 end
|
||||
end
|
||||
|
||||
function logo_update()
|
||||
intro_init()
|
||||
end
|
||||
function logo_end()
|
||||
-- print("LOGO_END")
|
||||
-- game_update = intro_init
|
||||
print("logo_end")
|
||||
flow:next()
|
||||
-- surf.free(logo_sf)
|
||||
end
|
||||
|
||||
function logo_animate()
|
||||
-- print("LOGO_INTRO "..logo_step)
|
||||
logo_wait=logo_wait-1
|
||||
|
||||
-- Següent bucle
|
||||
if logo_wait==0 or key.press(key.ESCAPE) or key.press(keyShoot) or pad.press(btnShoot) or pad.press(btnPause) then
|
||||
flow:next()
|
||||
end
|
||||
|
||||
logo_draw()
|
||||
logo_update()
|
||||
|
||||
if logo_step==7 then
|
||||
flow:next()
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user