First bundled release.
This commit is contained in:
76
load/bgm.lua
Normal file
76
load/bgm.lua
Normal file
@@ -0,0 +1,76 @@
|
||||
bgm = {
|
||||
credit_roll = {
|
||||
gm3 = love.audio.newSource("res/bgm/tgm_credit_roll.mp3", "stream"),
|
||||
},
|
||||
pacer_test = love.audio.newSource("res/bgm/pacer_test.mp3", "stream"),
|
||||
}
|
||||
|
||||
local current_bgm = nil
|
||||
local bgm_locked = false
|
||||
|
||||
function switchBGM(sound, subsound)
|
||||
if bgm_locked then return end
|
||||
if current_bgm ~= nil then
|
||||
current_bgm:stop()
|
||||
end
|
||||
if subsound ~= nil then
|
||||
current_bgm = bgm[sound][subsound]
|
||||
resetBGMFadeout()
|
||||
elseif sound ~= nil then
|
||||
current_bgm = bgm[sound]
|
||||
resetBGMFadeout()
|
||||
else
|
||||
current_bgm = nil
|
||||
end
|
||||
end
|
||||
|
||||
function switchBGMLoop(sound, subsound)
|
||||
if bgm_locked then return end
|
||||
switchBGM(sound, subsound)
|
||||
current_bgm:setLooping(true)
|
||||
end
|
||||
|
||||
function lockBGM()
|
||||
bgm_locked = true
|
||||
end
|
||||
|
||||
local fading_bgm = false
|
||||
local fadeout_time = 0
|
||||
local total_fadeout_time = 0
|
||||
|
||||
function fadeoutBGM(time)
|
||||
if fading_bgm == false then
|
||||
fading_bgm = true
|
||||
fadeout_time = time
|
||||
total_fadeout_time = time
|
||||
end
|
||||
end
|
||||
|
||||
function resetBGMFadeout(time)
|
||||
current_bgm:setVolume(1)
|
||||
fading_bgm = false
|
||||
current_bgm:play()
|
||||
end
|
||||
|
||||
function processBGMFadeout(dt)
|
||||
if fading_bgm then
|
||||
fadeout_time = fadeout_time - dt
|
||||
if fadeout_time < 0 then
|
||||
fadeout_time = 0
|
||||
fading_bgm = false
|
||||
end
|
||||
current_bgm:setVolume(fadeout_time / total_fadeout_time)
|
||||
end
|
||||
end
|
||||
|
||||
function pauseBGM()
|
||||
if current_bgm ~= nil then
|
||||
current_bgm:pause()
|
||||
end
|
||||
end
|
||||
|
||||
function resumeBGM()
|
||||
if current_bgm ~= nil then
|
||||
current_bgm:play()
|
||||
end
|
||||
end
|
||||
33
load/fonts.lua
Normal file
33
load/fonts.lua
Normal file
@@ -0,0 +1,33 @@
|
||||
font_3x5 = love.graphics.newImageFont(
|
||||
"res/fonts/3x5.png",
|
||||
" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_" ..
|
||||
"`abcdefghijklmnopqrstuvwxyz{|}~™",
|
||||
-1
|
||||
)
|
||||
|
||||
font_3x5_2 = love.graphics.newImageFont(
|
||||
"res/fonts/3x5_double.png",
|
||||
" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_" ..
|
||||
"`abcdefghijklmnopqrstuvwxyz{|}~™",
|
||||
-2
|
||||
)
|
||||
|
||||
font_3x5_3 = love.graphics.newImageFont(
|
||||
"res/fonts/3x5_medium.png",
|
||||
" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_" ..
|
||||
"`abcdefghijklmnopqrstuvwxyz{|}~",
|
||||
-3
|
||||
)
|
||||
|
||||
font_3x5_4 = love.graphics.newImageFont(
|
||||
"res/fonts/3x5_large.png",
|
||||
" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_" ..
|
||||
"`abcdefghijklmnopqrstuvwxyz{|}~",
|
||||
-4
|
||||
)
|
||||
|
||||
font_8x11 = love.graphics.newImageFont(
|
||||
"res/fonts/8x11_medium.png",
|
||||
"0123456789:.",
|
||||
1
|
||||
)
|
||||
58
load/graphics.lua
Normal file
58
load/graphics.lua
Normal file
@@ -0,0 +1,58 @@
|
||||
backgrounds = {
|
||||
[0] = love.graphics.newImage("res/backgrounds/0-quantum-foam.png"),
|
||||
love.graphics.newImage("res/backgrounds/100-big-bang.png"),
|
||||
love.graphics.newImage("res/backgrounds/200-spiral-galaxy.png"),
|
||||
love.graphics.newImage("res/backgrounds/300-sun-and-dust.png"),
|
||||
love.graphics.newImage("res/backgrounds/400-earth-and-moon.png"),
|
||||
love.graphics.newImage("res/backgrounds/500-cambrian-explosion.png"),
|
||||
love.graphics.newImage("res/backgrounds/600-dinosaurs.png"),
|
||||
love.graphics.newImage("res/backgrounds/700-asteroid.png"),
|
||||
love.graphics.newImage("res/backgrounds/800-human-fire.png"),
|
||||
love.graphics.newImage("res/backgrounds/900-early-civilization.png"),
|
||||
love.graphics.newImage("res/backgrounds/1000-vikings.png"),
|
||||
love.graphics.newImage("res/backgrounds/1100-crusades.png"),
|
||||
love.graphics.newImage("res/backgrounds/1200-genghis-khan.png"),
|
||||
love.graphics.newImage("res/backgrounds/1300-black-death.png"),
|
||||
love.graphics.newImage("res/backgrounds/1400-columbus-discovery.png"),
|
||||
love.graphics.newImage("res/backgrounds/1500-aztecas.png"),
|
||||
love.graphics.newImage("res/backgrounds/1600-telescope.png"),
|
||||
love.graphics.newImage("res/backgrounds/1700-american-revolution.png"),
|
||||
love.graphics.newImage("res/backgrounds/1800-railways.png"),
|
||||
love.graphics.newImage("res/backgrounds/1900-world-wide-web.png"),
|
||||
title = love.graphics.newImage("res/backgrounds/title_v0.1.png"),
|
||||
}
|
||||
|
||||
blocks = {
|
||||
["2tie"] = {
|
||||
I = love.graphics.newImage("res/img/s1.png"),
|
||||
J = love.graphics.newImage("res/img/s4.png"),
|
||||
L = love.graphics.newImage("res/img/s3.png"),
|
||||
O = love.graphics.newImage("res/img/s7.png"),
|
||||
S = love.graphics.newImage("res/img/s5.png"),
|
||||
T = love.graphics.newImage("res/img/s2.png"),
|
||||
Z = love.graphics.newImage("res/img/s6.png"),
|
||||
F = love.graphics.newImage("res/img/s9.png"),
|
||||
G = love.graphics.newImage("res/img/s9.png"),
|
||||
X = love.graphics.newImage("res/img/s9.png"),
|
||||
},
|
||||
["bone"] = {
|
||||
I = love.graphics.newImage("res/img/bone.png"),
|
||||
J = love.graphics.newImage("res/img/bone.png"),
|
||||
L = love.graphics.newImage("res/img/bone.png"),
|
||||
O = love.graphics.newImage("res/img/bone.png"),
|
||||
S = love.graphics.newImage("res/img/bone.png"),
|
||||
T = love.graphics.newImage("res/img/bone.png"),
|
||||
Z = love.graphics.newImage("res/img/bone.png"),
|
||||
F = love.graphics.newImage("res/img/bone.png"),
|
||||
G = love.graphics.newImage("res/img/bone.png"),
|
||||
X = love.graphics.newImage("res/img/bone.png"),
|
||||
}
|
||||
}
|
||||
|
||||
misc_graphics = {
|
||||
frame = love.graphics.newImage("res/img/frame.png"),
|
||||
ready = love.graphics.newImage("res/img/ready.png"),
|
||||
go = love.graphics.newImage("res/img/go.png"),
|
||||
select_mode = love.graphics.newImage("res/img/select_mode.png"),
|
||||
strike = love.graphics.newImage("res/img/strike.png"),
|
||||
}
|
||||
24
load/save.lua
Normal file
24
load/save.lua
Normal file
@@ -0,0 +1,24 @@
|
||||
local binser = require 'libs.binser'
|
||||
|
||||
function loadSave()
|
||||
config = loadFromFile('config.sav')
|
||||
highscores = loadFromFile('highscores.sav')
|
||||
end
|
||||
|
||||
function loadFromFile(filename)
|
||||
local save_data, len = binser.readFile(filename)
|
||||
if save_data == nil then
|
||||
return {} -- new object
|
||||
end
|
||||
return save_data[1]
|
||||
end
|
||||
|
||||
|
||||
|
||||
function saveConfig()
|
||||
binser.writeFile('config.sav', config)
|
||||
end
|
||||
|
||||
function saveHighscores()
|
||||
binser.writeFile('highscores.sav', highscores)
|
||||
end
|
||||
29
load/sounds.lua
Normal file
29
load/sounds.lua
Normal file
@@ -0,0 +1,29 @@
|
||||
sounds = {
|
||||
blocks = {
|
||||
I = love.audio.newSource("res/se/piece_i.wav", "static"),
|
||||
J = love.audio.newSource("res/se/piece_j.wav", "static"),
|
||||
L = love.audio.newSource("res/se/piece_l.wav", "static"),
|
||||
O = love.audio.newSource("res/se/piece_o.wav", "static"),
|
||||
S = love.audio.newSource("res/se/piece_s.wav", "static"),
|
||||
T = love.audio.newSource("res/se/piece_t.wav", "static"),
|
||||
Z = love.audio.newSource("res/se/piece_z.wav", "static")
|
||||
},
|
||||
move = love.audio.newSource("res/se/move.wav", "static"),
|
||||
bottom = love.audio.newSource("res/se/bottom.wav", "static"),
|
||||
}
|
||||
|
||||
function playSE(sound, subsound)
|
||||
if subsound == nil then
|
||||
sounds[sound]:setVolume(0.1)
|
||||
if sounds[sound]:isPlaying() then
|
||||
sounds[sound]:stop()
|
||||
end
|
||||
sounds[sound]:play()
|
||||
else
|
||||
sounds[sound][subsound]:setVolume(0.1)
|
||||
if sounds[sound][subsound]:isPlaying() then
|
||||
sounds[sound][subsound]:stop()
|
||||
end
|
||||
sounds[sound][subsound]:play()
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user