forked from JailDoctor/cacaus
161 lines
4.6 KiB
Lua
161 lines
4.6 KiB
Lua
require "final"
|
|
require "fade"
|
|
require "audio"
|
|
require "dead"
|
|
require "scenes"
|
|
require "trigger"
|
|
require "score"
|
|
require "switches"
|
|
require "map"
|
|
require "mapa"
|
|
require "bol"
|
|
require "invisibl"
|
|
require "gota"
|
|
require "fireball"
|
|
require "cacau"
|
|
require "bambolla"
|
|
require "imp"
|
|
require "gps"
|
|
require "peu"
|
|
require "gorro"
|
|
require "batman"
|
|
require "elalien"
|
|
require "premiere"
|
|
require "caco"
|
|
require "zombie"
|
|
require "abad"
|
|
require "intro"
|
|
require "game"
|
|
|
|
local arcade_config = require("arcade_config")
|
|
|
|
--require "fade"
|
|
--require "audio"
|
|
--require "intro"
|
|
|
|
function mini.init()
|
|
tiles=surf.load("tiles.gif")
|
|
surf.source(tiles)
|
|
local paleta=pal.load("tiles.gif")
|
|
pal.set(paleta)
|
|
|
|
-- logo=surf.new(72,10)
|
|
logo=surf.new(arcade_config.logo_sf.width,arcade_config.logo_sf.height)
|
|
-- back=surf.new(128,96)
|
|
back=surf.new(arcade_config.surface.width,arcade_config.surface.height)
|
|
fade.init()
|
|
|
|
textsf=surf.new(arcade_config.org_resolucion.width,arcade_config.org_resolucion.height)
|
|
|
|
-- Càrrega dels audios
|
|
audio_text_abad = sound.load(audio_text_abad)
|
|
audio_text_premiere = sound.load(audio_text_premiere)
|
|
audio_text_elalien = sound.load(audio_text_elalien)
|
|
audio_text_batman = sound.load(audio_text_batman)
|
|
audio_abad_jump = sound.load(audio_abad_jump)
|
|
audio_abad_fall = sound.load(audio_abad_fall)
|
|
audio_abad_hit = sound.load(audio_abad_hit)
|
|
audio_abad_shot = sound.load(audio_abad_shot)
|
|
audio_abad_step[1] = sound.load(audio_abad_step[1])
|
|
audio_abad_step[2] = sound.load(audio_abad_step[2])
|
|
audio_abad_step[3] = sound.load(audio_abad_step[3])
|
|
audio_abad_step[4] = audio_abad_step[2]
|
|
audio_switch = sound.load(audio_switch)
|
|
audio_hit = sound.load(audio_hit)
|
|
audio_low = sound.load(audio_low)
|
|
|
|
-- Configuració dels input
|
|
keyUp = tonumber(config.key("keyup")) or key.UP
|
|
keyDown = tonumber(config.key("keydown")) or key.DOWN
|
|
keyLeft = tonumber(config.key("keyleft")) or key.LEFT
|
|
keyRight = tonumber(config.key("keyright")) or key.RIGHT
|
|
keyJump = tonumber(config.key("keyjump")) or key.UP
|
|
keyShoot = tonumber(config.key("keyshoot")) or key.SPACE
|
|
|
|
btnUp = tonumber(config.key("btnup")) or pad.UP
|
|
btnDown = tonumber(config.key("btndown")) or pad.DOWN
|
|
btnLeft = tonumber(config.key("btnleft")) or pad.LEFT
|
|
btnRight = tonumber(config.key("btnright")) or pad.RIGHT
|
|
btnJump = tonumber(config.key("btnjump")) or pad.B
|
|
btnShoot = tonumber(config.key("btnshoot")) or pad.A
|
|
btnCycle1 = tonumber(config.key("btncycle1")) or pad.RIGHTSHOULDER
|
|
btnCycle2 = tonumber(config.key("btncycle2")) or pad.LEFTSHOULDER
|
|
btnPause = tonumber(config.key("btnpause")) or pad.START
|
|
|
|
--game_init()
|
|
intro_init()
|
|
-- final_init()
|
|
end
|
|
|
|
function mini.update()
|
|
if key.press(key.F1) then
|
|
win.zoom(win.zoom()-1)
|
|
elseif key.press(key.F2) then
|
|
win.zoom(win.zoom()+1)
|
|
elseif key.press(key.F3) then
|
|
local fs = win.fullscreen()
|
|
win.fullscreen(not fs)
|
|
win.cursor(fs)
|
|
end
|
|
|
|
if (game_update) then game_update() end
|
|
end
|
|
|
|
function text(str,x,y,col)
|
|
draw.text(str,x-1,y-1,16)
|
|
draw.text(str,x,y-1,16)
|
|
draw.text(str,x+1,y-1,16)
|
|
draw.text(str,x-1,y,16)
|
|
draw.text(str,x+1,y,16)
|
|
draw.text(str,x-1,y+1,16)
|
|
draw.text(str,x,y+1,16)
|
|
draw.text(str,x+1,y+1,16)
|
|
|
|
draw.text(str,x,y,col)
|
|
end
|
|
|
|
function arc_text(str, x, y, col)
|
|
local curr_surf_tgt = surf.target()
|
|
local curr_surf_src = surf.source()
|
|
local sw = arcade_config.org_resolucion.width
|
|
local sh = arcade_config.org_resolucion.height
|
|
local dw = arcade_config.resolucion.width
|
|
local dh = arcade_config.resolucion.height
|
|
surf.target(textsf)
|
|
surf.cls(0)
|
|
draw.text(str,0,0,col)
|
|
-- print("arc_ "..str)
|
|
surf.source(textsf)
|
|
surf.target(curr_surf_tgt)
|
|
draw.surf(0,0,sw,sh,x,y,dw,dh)
|
|
surf.source(curr_surf_src)
|
|
end
|
|
|
|
function arc_textB(str, x, y, col)
|
|
local ox, oy = view.origin()
|
|
local curr_surf_tgt = surf.target()
|
|
local curr_surf_src = surf.source()
|
|
local sw = arcade_config.org_resolucion.width
|
|
local sh = arcade_config.org_resolucion.height
|
|
local dw = arcade_config.resolucion.width
|
|
local dh = arcade_config.resolucion.height
|
|
surf.target(textsf)
|
|
view.origin(0,0)
|
|
surf.cls(0)
|
|
draw.text(str,0,0,16)
|
|
draw.text(str,1,0,16)
|
|
draw.text(str,2,0,16)
|
|
draw.text(str,0,1,16)
|
|
draw.text(str,2,1,16)
|
|
draw.text(str,0,2,16)
|
|
draw.text(str,1,2,16)
|
|
draw.text(str,2,2,16)
|
|
|
|
draw.text(str,1,1,col)
|
|
-- print("arc_B "..str)
|
|
surf.source(textsf)
|
|
surf.target(curr_surf_tgt)
|
|
view.origin(ox,oy)
|
|
draw.surf(0,0,sw,sh,x,y,dw,dh)
|
|
surf.source(curr_surf_src)
|
|
end |