Final FINAL physics tweaks. Game is done. Doing audio only until deadline.
This commit is contained in:
parent
e600760281
commit
25a3047a10
70
audio.lua
70
audio.lua
|
@ -1,8 +1,9 @@
|
|||
local love = love
|
||||
local passChimes = {}
|
||||
local failChimes = {}
|
||||
local wineChimes = {}
|
||||
local drones = {}
|
||||
local N = 8
|
||||
local N = 12
|
||||
|
||||
love.audio.setDistanceModel( "exponentclamped" )
|
||||
|
||||
|
@ -13,50 +14,70 @@ local function StartDrones()
|
|||
decaytime = 20}
|
||||
|
||||
)
|
||||
|
||||
drones.fuck = love.audio.newSource("sounds/noiseloop.flac", "static" )
|
||||
drones.bass = love.audio.newSource("sounds/drone.flac", "stream")
|
||||
drones.alto = love.audio.newSource("sounds/drone.flac", "stream")
|
||||
|
||||
drones.bass:setVolume( 0 )
|
||||
drones.bass:setPitch( 0.125 )
|
||||
drones.alto:setVolume( 0 )
|
||||
drones.bass:setPitch( 0.25 )
|
||||
drones.bass:setEffect( "droneReverb", true )
|
||||
drones.alto:setEffect( "droneReverb", true )
|
||||
drones.bass:stop()
|
||||
|
||||
drones.alto:setVolume( 0 )
|
||||
drones.alto:setPitch( 2 )
|
||||
drones.alto:setEffect( "droneReverb", true )
|
||||
drones.alto:stop()
|
||||
|
||||
drones.fuck:setVolume( 0 )
|
||||
drones.fuck:setPitch( 0.125 )
|
||||
drones.fuck:setEffect( "droneReverb", true )
|
||||
drones.fuck:stop()
|
||||
|
||||
love.audio.play( drones.bass )
|
||||
love.audio.play( drones.alto )
|
||||
love.audio.play( drones.fuck )
|
||||
end
|
||||
|
||||
love.audio.setEffect( "passChimeReverb", {
|
||||
type = "reverb",
|
||||
volume = 1.0, } )
|
||||
volume = 1.0,
|
||||
gain = 1.0,} )
|
||||
|
||||
local wineChime = love.audio.newSource("sounds/chimewinedolce.flac", "static")
|
||||
wineChime:setEffect( "passChimeReverb", true )
|
||||
local passChime = love.audio.newSource("sounds/chimeb.flac", "static")
|
||||
passChime:setEffect( "passChimeReverb", true )
|
||||
local failChime = love.audio.newSource("sounds/chime.flac", "static")
|
||||
failChime:setEffect( "passChimeReverb", true )
|
||||
|
||||
for i = 1, N do
|
||||
wineChimes[i] = wineChime:clone()
|
||||
passChimes[i] = passChime:clone()
|
||||
failChimes[i] = failChime:clone()
|
||||
end
|
||||
|
||||
local idxNextPassChime = 1
|
||||
local idxNextFailChime = 1
|
||||
local function GetNextPassChime( pass )
|
||||
local idxNextWineChime = 1
|
||||
local function GetNextPassChime( )
|
||||
idxNextPassChime = idxNextPassChime % N + 1
|
||||
return passChimes[ idxNextPassChime ]
|
||||
end
|
||||
|
||||
local function GetNextFailChime( pass )
|
||||
local function GetNextFailChime( )
|
||||
idxNextFailChime = idxNextFailChime % N + 1
|
||||
return failChimes[ idxNextFailChime ]
|
||||
end
|
||||
|
||||
local function GetNextWineChime( )
|
||||
idxNextWineChime = idxNextWineChime % N + 1
|
||||
return wineChimes[ idxNextWineChime ]
|
||||
end
|
||||
|
||||
local pitches =
|
||||
{
|
||||
1/2,
|
||||
3/4,
|
||||
1,
|
||||
2/3,
|
||||
3/2,
|
||||
|
@ -69,7 +90,7 @@ local pitches =
|
|||
|
||||
local function GetPitch( th )
|
||||
th = 0.5 + 0.5 * th / math.pi
|
||||
return pitches[ 1 + math.floor( th * 7 )]
|
||||
return pitches[ 1 + math.floor( th * 9 )]
|
||||
end
|
||||
|
||||
local function OnImpact( impact, score, pass, level )
|
||||
|
@ -83,7 +104,8 @@ local function OnImpact( impact, score, pass, level )
|
|||
love.audio.setEffect( "passChimeReverb", {
|
||||
type = "reverb",
|
||||
volume = 1.0,
|
||||
gain = 0.1 + level / 200} )
|
||||
gain = 0.1 + 0.9 * level / 120,
|
||||
highgain = 0.3,} )
|
||||
|
||||
end
|
||||
|
||||
|
@ -94,8 +116,8 @@ local function OnImpact( impact, score, pass, level )
|
|||
local chime = pass and GetNextPassChime() or GetNextFailChime()
|
||||
chime:setPitch( GetPitch( th ) )
|
||||
chime:setPosition( r * math.cos( th ), r * math.sin( th ) )
|
||||
chime:setVolume( 0.1 + level / 200 )
|
||||
local highgain = math.max( 0, math.min( score, 1.0 ) - (pass and 0.0 or 0.9))
|
||||
chime:setVolume( 0.1 + 0.9 * level / 120.0 )
|
||||
local highgain = math.max( 0, math.min( score, 1.0 ) - (pass and 0.5 or 0.9))
|
||||
chime:setFilter{
|
||||
type = "lowpass",
|
||||
volume = 0.5 * impact.speed,
|
||||
|
@ -104,27 +126,43 @@ local function OnImpact( impact, score, pass, level )
|
|||
love.audio.stop( chime )
|
||||
love.audio.play( chime )
|
||||
|
||||
local wineChime = GetNextWineChime()
|
||||
wineChime:setPitch( GetPitch( th ) )
|
||||
wineChime:setPosition( love.math.random(), love.math.random() )
|
||||
wineChime:setVolume( impact.speed * math.max( 0.0, level / 60.0 - 0.5 ) )
|
||||
|
||||
love.audio.stop( wineChime )
|
||||
love.audio.play( wineChime )
|
||||
|
||||
end
|
||||
|
||||
local function OnVictory( )
|
||||
love.audio.setEffect( "passChimeReverb", {
|
||||
type = "reverb",
|
||||
volume = 1.0,
|
||||
decaytime = 20,} )
|
||||
decaytime = 20,
|
||||
lategain = 9.5,
|
||||
gain = 1.0,
|
||||
} )
|
||||
|
||||
love.audio.setEffect( "droneReverb", {
|
||||
type = "reverb",
|
||||
volume = 1.0,
|
||||
decaytime = 20,} )
|
||||
decaytime = 20,
|
||||
lategain = 10,
|
||||
gain = 1.0,} )
|
||||
end
|
||||
|
||||
--score is the hypothetical "beat score" that would be attained
|
||||
--if an impact took place at this instant.
|
||||
local function Update( score, level )
|
||||
|
||||
|
||||
|
||||
if level > 2 then
|
||||
drones.bass:setVolume( 0.5 * math.sqrt( score ) * (level / 120) )
|
||||
drones.alto:setVolume( 0.3 * score * ( level / 120 ))
|
||||
level = level / 120.0
|
||||
drones.bass:setVolume( 0.5 * math.sqrt( score ) * level )
|
||||
drones.alto:setVolume( 0.3 * score * level * level)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
10
main.lua
10
main.lua
|
@ -75,7 +75,7 @@ OnImpact = function( impact )
|
|||
particles:emit( 50 * score * score )
|
||||
|
||||
audio.OnImpact( impact, score, pass, state.currentBeat )
|
||||
marble.OnImpact( impact )
|
||||
marble.OnImpact( impact, state.currentBeat )
|
||||
wave.OnImpact( impact, state.currentBeat )
|
||||
end
|
||||
local _OnImpact = OnImpact
|
||||
|
@ -191,19 +191,17 @@ OnVictory = function()
|
|||
particles:setParticleLifetime( 0, 30 )
|
||||
particles:setSizes( 0.001, 0.0001, 0.0005 )
|
||||
particles:setColors(
|
||||
1, 1, 1, 1,
|
||||
245 / 255, 169 / 255, 184 / 255, 1,
|
||||
1, 1, 1, 1,
|
||||
245 / 255, 169 / 255, 184 / 255, 1,
|
||||
1, 1, 1, 0,
|
||||
0, 0, 0, 1,
|
||||
245 / 255, 169 / 255, 184 / 255, 1,
|
||||
0, 0, 0, 1,
|
||||
1, 1, 1, 0
|
||||
)
|
||||
particles:setPosition( 0, 0 )
|
||||
particles:setEmissionArea( "normal", 0.5, 0.5, 0, true )
|
||||
particles:emit( 500 )
|
||||
particles:setEmissionArea( "normal", 0.1, 0.1, 0, true )
|
||||
particles:setEmissionArea( "normal", 0.01, 0.01, 0, true )
|
||||
|
||||
love.graphics.setCanvas( marble.Canvas() )
|
||||
love.graphics.setCanvas()
|
||||
|
@ -221,7 +219,7 @@ OnVictory = function()
|
|||
end
|
||||
|
||||
local marblePos = marble.Current()
|
||||
particles:emit( 10 )
|
||||
particles:emit( 1 )
|
||||
particles:update( dt )
|
||||
particles:moveTo( marblePos.x, marblePos.y )
|
||||
end
|
||||
|
|
21
marble.lua
21
marble.lua
|
@ -5,8 +5,8 @@ local oldBuffer = love.graphics.newCanvas()
|
|||
local newBuffer = love.graphics.newCanvas()
|
||||
local oldState, curState, newState
|
||||
|
||||
local INERTIA= 0.03
|
||||
local MAXSPEED = 3
|
||||
local INERTIA = 0.01
|
||||
local MAXSPEED = 6
|
||||
local ddx, ddy = 0.0, 0.0
|
||||
|
||||
local function State( )
|
||||
|
@ -21,20 +21,19 @@ function marble.GetAcceleration( ) return ddx, ddy end
|
|||
|
||||
function marble.Integrate( step )
|
||||
newState.t = love.timer.getTime()
|
||||
newState.dx = (1.0 - INERTIA
|
||||
) * curState.dx + INERTIA
|
||||
* ddx
|
||||
newState.dy = (1.0 - INERTIA
|
||||
) * curState.dy + INERTIA
|
||||
* ddy
|
||||
newState.dx = (1.0 - INERTIA) * curState.dx + INERTIA * ddx
|
||||
newState.dy = (1.0 - INERTIA) * curState.dy + INERTIA * ddy
|
||||
newState.x = curState.x + newState.dx * step * MAXSPEED
|
||||
newState.y = curState.y + newState.dy * step * MAXSPEED
|
||||
end
|
||||
|
||||
function marble.OnImpact( impact )
|
||||
function marble.OnImpact( impact, level )
|
||||
--Adjust current trajectory according to collision.
|
||||
if not impact.dt then return end
|
||||
|
||||
INERTIA = 0.05 - 0.04 * ( level / 120.0 )
|
||||
MAXSPEED = 2.0 + 4.0 * ( level / 120.0 )
|
||||
|
||||
local x, y = impact.r * math.cos( impact.th ), impact.r * math.sin( impact.th )
|
||||
local vx, vy = newState.dx, newState.dy --Velocity of particle going into collision.
|
||||
local unx, uny = math.cos( impact.normal ), math.sin( impact.normal ) --Outward-facing normal of wave.
|
||||
|
@ -174,6 +173,10 @@ function marble.Resize()
|
|||
end
|
||||
|
||||
function marble.Reset()
|
||||
|
||||
INERTIA = 0.05
|
||||
MAXSPEED = 2.0
|
||||
|
||||
oldState, curState, newState = State(), State(), State()
|
||||
marble.Resize()
|
||||
marble.Draw = marble._Draw
|
||||
|
|
|
@ -15,8 +15,8 @@ sp.Draw = function( t )
|
|||
if #t == 1 then
|
||||
love.graphics.draw( sp[t[1]] or sp.pilin, cx - 128, cy - 128 )
|
||||
elseif #t == 2 then
|
||||
love.graphics.draw( sp[t[1]] or sp.pilin, cx - 128, cy - 64, 0, 0.5, 0.5 )
|
||||
love.graphics.draw( sp[t[2]] or sp.pilin, cx, cy - 64, 0, 0.5, 0.5 )
|
||||
love.graphics.draw( sp[t[1]] or sp.pilin, cx - 144, cy - 96, 0, 0.75, 0.75 )
|
||||
love.graphics.draw( sp[t[2]] or sp.pilin, cx - 16, cy - 96, 0, 0.75, 0.75 )
|
||||
elseif #t == 3 then
|
||||
love.graphics.draw( sp[t[1]] or sp.pilin, cx - 128, cy - 64, 0, 0.5, 0.5 )
|
||||
love.graphics.draw( sp[t[1]] or sp.pilin, cx - 128, cy - 64, 0, 0.5, 0.5 )
|
||||
|
|
4
text.lua
4
text.lua
|
@ -39,9 +39,11 @@ for foot in s:gmatch( ".-%-" ) do
|
|||
local j = 1
|
||||
|
||||
for w in foot:gmatch( [["]] ) do
|
||||
|
||||
word[j] = isTe and "te" or "to"
|
||||
isTe = not( isTe )
|
||||
j = j + 1
|
||||
|
||||
end
|
||||
|
||||
for w in foot:gmatch( "%a+" ) do
|
||||
|
@ -59,7 +61,7 @@ local function Draw( beat )
|
|||
if beat == 1 then
|
||||
love.graphics.setColor(0.0, 0.0, 0.0, 1.0)
|
||||
love.graphics.printf( "wasd.space",
|
||||
0, 0.5 * love.graphics.getHeight(),
|
||||
0, 0,
|
||||
love.graphics.getWidth(),
|
||||
"center"
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue