Add more sounds, more feedback on victory condition.
This commit is contained in:
parent
ae75751f32
commit
e600760281
|
@ -95,7 +95,7 @@ local function OnImpact( impact, score, pass, level )
|
||||||
chime:setPitch( GetPitch( th ) )
|
chime:setPitch( GetPitch( th ) )
|
||||||
chime:setPosition( r * math.cos( th ), r * math.sin( th ) )
|
chime:setPosition( r * math.cos( th ), r * math.sin( th ) )
|
||||||
chime:setVolume( 0.1 + level / 200 )
|
chime:setVolume( 0.1 + level / 200 )
|
||||||
local highgain = math.max( 0, math.min( score, 1.0 ) - (pass and 0.0 or 0.5))
|
local highgain = math.max( 0, math.min( score, 1.0 ) - (pass and 0.0 or 0.9))
|
||||||
chime:setFilter{
|
chime:setFilter{
|
||||||
type = "lowpass",
|
type = "lowpass",
|
||||||
volume = 0.5 * impact.speed,
|
volume = 0.5 * impact.speed,
|
||||||
|
@ -111,6 +111,11 @@ local function OnVictory( )
|
||||||
type = "reverb",
|
type = "reverb",
|
||||||
volume = 1.0,
|
volume = 1.0,
|
||||||
decaytime = 20,} )
|
decaytime = 20,} )
|
||||||
|
|
||||||
|
love.audio.setEffect( "droneReverb", {
|
||||||
|
type = "reverb",
|
||||||
|
volume = 1.0,
|
||||||
|
decaytime = 20,} )
|
||||||
end
|
end
|
||||||
|
|
||||||
--score is the hypothetical "beat score" that would be attained
|
--score is the hypothetical "beat score" that would be attained
|
||||||
|
|
94
main.lua
94
main.lua
|
@ -12,6 +12,7 @@ local OnImpact
|
||||||
local OnVictory
|
local OnVictory
|
||||||
local BeatScore
|
local BeatScore
|
||||||
local Draw
|
local Draw
|
||||||
|
local Update
|
||||||
local ExtrapolateBeatScore
|
local ExtrapolateBeatScore
|
||||||
local _ExtrapolateBeatScore
|
local _ExtrapolateBeatScore
|
||||||
|
|
||||||
|
@ -84,7 +85,9 @@ local function NewGame()
|
||||||
OnImpact = _OnImpact
|
OnImpact = _OnImpact
|
||||||
ExtrapolateBeatScore = _ExtrapolateBeatScore
|
ExtrapolateBeatScore = _ExtrapolateBeatScore
|
||||||
love.draw = Draw
|
love.draw = Draw
|
||||||
|
love.update = Update
|
||||||
particles:reset()
|
particles:reset()
|
||||||
|
particles:setSizes( 0.0007, 0.0001, 0.0003 )
|
||||||
state.Reset()
|
state.Reset()
|
||||||
marble.Reset()
|
marble.Reset()
|
||||||
wave.Reset()
|
wave.Reset()
|
||||||
|
@ -100,19 +103,23 @@ function love.load()
|
||||||
love.graphics.newImage( "prideflag.png" ),
|
love.graphics.newImage( "prideflag.png" ),
|
||||||
1024)
|
1024)
|
||||||
|
|
||||||
particles:setSizes( 0.00015, 0.0001, 0.00018 )
|
--particles:setSizes( 0.0007, 0.0001, 0.0003 )
|
||||||
particles:setSizeVariation( 1 )
|
particles:setSizeVariation( 1 )
|
||||||
particles:setRadialAcceleration( 0, 0.5 )
|
particles:setRadialAcceleration( 0, 0.5 )
|
||||||
particles:setSpeed( 0.2, 1 )
|
particles:setSpeed( 0.2, 1 )
|
||||||
particles:setLinearDamping( 1, 10 )
|
particles:setLinearDamping( 1, 10 )
|
||||||
particles:setRelativeRotation( true )
|
particles:setRelativeRotation( true )
|
||||||
particles:setEmitterLifetime( -1 )
|
particles:setEmitterLifetime( -1 )
|
||||||
particles:setParticleLifetime( 0, 15 )
|
particles:setParticleLifetime( 0, 5 )
|
||||||
particles:setSpread( 0.05 )
|
particles:setSpread( 0.05 )
|
||||||
particles:setColors(
|
particles:setColors(
|
||||||
1, 1, 1, 1,
|
1, 1, 1, 1,
|
||||||
91 / 255, 206 / 255, 250 / 255, 1,
|
91 / 255, 206 / 255, 250 / 255, 1,
|
||||||
245 / 255, 169 / 255, 184 / 255, 1,
|
245 / 255, 169 / 255, 184 / 255, 1,
|
||||||
|
1,1,1,0,
|
||||||
|
245 / 255, 169 / 255, 184 / 255, 1,
|
||||||
|
1,1,1,0,
|
||||||
|
245 / 255, 169 / 255, 184 / 255, 1,
|
||||||
1,1,1,0
|
1,1,1,0
|
||||||
|
|
||||||
)
|
)
|
||||||
|
@ -181,16 +188,58 @@ end
|
||||||
|
|
||||||
OnVictory = function()
|
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,
|
||||||
|
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 )
|
||||||
|
|
||||||
|
love.graphics.setCanvas( marble.Canvas() )
|
||||||
|
love.graphics.setCanvas()
|
||||||
|
|
||||||
local totalTime = love.timer.getTime() - state.startTime
|
local totalTime = love.timer.getTime() - state.startTime
|
||||||
OnImpact = function() end
|
OnImpact = function() end
|
||||||
|
love.update = function( dt )
|
||||||
|
while dt > step do
|
||||||
|
marble.Integrate( step )
|
||||||
|
wave.Integrate( step )
|
||||||
|
marble.Update()
|
||||||
|
wave.Update()
|
||||||
|
|
||||||
|
dt = dt - step
|
||||||
|
end
|
||||||
|
|
||||||
|
local marblePos = marble.Current()
|
||||||
|
particles:emit( 10 )
|
||||||
|
particles:update( dt )
|
||||||
|
particles:moveTo( marblePos.x, marblePos.y )
|
||||||
|
end
|
||||||
love.draw = function()
|
love.draw = function()
|
||||||
|
love.graphics.push( "transform" )
|
||||||
|
love.graphics.applyTransform( transform )
|
||||||
love.graphics.setColor( 1, 1, 1, 1 )
|
love.graphics.setColor( 1, 1, 1, 1 )
|
||||||
|
love.graphics.draw( particles )
|
||||||
|
love.graphics.pop()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
text.Draw( 119 )
|
text.Draw( 119 )
|
||||||
|
|
||||||
|
love.graphics.setColor( 1, 1, 1, 1 )
|
||||||
love.graphics.printf(
|
love.graphics.printf(
|
||||||
"your.time:\n"..totalTime,
|
"time:\n"..string.format( "%.3f", totalTime ):gsub( "%.", "," ),
|
||||||
0, 0.5 * love.graphics.getHeight(),
|
0, 0.5 * love.graphics.getHeight() - love.graphics.getFont():getHeight(),
|
||||||
love.graphics.getWidth(),
|
love.graphics.getWidth(),
|
||||||
"center"
|
"center"
|
||||||
)
|
)
|
||||||
|
@ -207,41 +256,15 @@ Draw = function()
|
||||||
|
|
||||||
|
|
||||||
love.graphics.push( "transform" )
|
love.graphics.push( "transform" )
|
||||||
|
|
||||||
love.graphics.applyTransform( transform )
|
love.graphics.applyTransform( transform )
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
wave.Draw( score )
|
|
||||||
|
|
||||||
|
|
||||||
love.graphics.setColor( 1.0, 1.0, 1.0, 1.0 )
|
love.graphics.setColor( 1.0, 1.0, 1.0, 1.0 )
|
||||||
love.graphics.draw(particles, 0, 0)
|
love.graphics.draw(particles, 0, 0)
|
||||||
|
wave.Draw( score )
|
||||||
--[[if debugRenderImpact then
|
|
||||||
|
|
||||||
love.graphics.setLineWidth( 0.01 )
|
|
||||||
love.graphics.setColor( 1, 0, 0, 0.5 ) --Red: Incoming
|
|
||||||
love.graphics.line(
|
|
||||||
debugRenderImpact.xi,
|
|
||||||
debugRenderImpact.yi,
|
|
||||||
debugRenderImpact.xf,
|
|
||||||
debugRenderImpact.yf)
|
|
||||||
love.graphics.setColor( 0, 1, 0, 0.5 ) --Green: Normal
|
|
||||||
love.graphics.line(
|
|
||||||
debugRenderImpact.xi,
|
|
||||||
debugRenderImpact.yi,
|
|
||||||
debugRenderImpact.xn,
|
|
||||||
debugRenderImpact.yn)
|
|
||||||
love.graphics.setColor( 0, 0, 1, 0.5 ) -- Blue: Outgoing
|
|
||||||
love.graphics.line(
|
|
||||||
debugRenderImpact.xi,
|
|
||||||
debugRenderImpact.yi,
|
|
||||||
debugRenderImpact.vxout,
|
|
||||||
debugRenderImpact.vyout)
|
|
||||||
|
|
||||||
end]]
|
|
||||||
|
|
||||||
love.graphics.pop()
|
love.graphics.pop()
|
||||||
|
|
||||||
|
|
||||||
sitelenpona.Draw( text.words[state.currentBeat] )
|
sitelenpona.Draw( text.words[state.currentBeat] )
|
||||||
marble.Draw()
|
marble.Draw()
|
||||||
text.Draw( state.currentBeat )
|
text.Draw( state.currentBeat )
|
||||||
|
@ -250,7 +273,7 @@ end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function love.update( dt )
|
Update = function( dt )
|
||||||
|
|
||||||
audio.Update( ExtrapolateBeatScore(), state.currentBeat )
|
audio.Update( ExtrapolateBeatScore(), state.currentBeat )
|
||||||
particles:update( dt )
|
particles:update( dt )
|
||||||
|
@ -275,6 +298,7 @@ function love.update( dt )
|
||||||
end
|
end
|
||||||
state.timeToSimulate = dt
|
state.timeToSimulate = dt
|
||||||
end
|
end
|
||||||
|
_Update = Update
|
||||||
|
|
||||||
function love.keypressed( key, code, isRepeat )
|
function love.keypressed( key, code, isRepeat )
|
||||||
if key == "escape" then return love.event.quit() end
|
if key == "escape" then return love.event.quit() end
|
||||||
|
|
|
@ -13,7 +13,6 @@ local function State( )
|
||||||
return { t = 0, x = 0, y = 0, dx = 0, dy = 0 }
|
return { t = 0, x = 0, y = 0, dx = 0, dy = 0 }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function marble.Current() return curState end
|
function marble.Current() return curState end
|
||||||
|
|
||||||
function marble.Next() return newState end
|
function marble.Next() return newState end
|
||||||
|
@ -99,7 +98,7 @@ end
|
||||||
|
|
||||||
function marble.OnVictory()
|
function marble.OnVictory()
|
||||||
|
|
||||||
marble.Draw = function()
|
--[[marble.Draw = function()
|
||||||
|
|
||||||
--Extrapolate forward for slightly smoother rendering.
|
--Extrapolate forward for slightly smoother rendering.
|
||||||
local dt = love.timer.getTime() - curState.t
|
local dt = love.timer.getTime() - curState.t
|
||||||
|
@ -118,7 +117,7 @@ function marble.OnVictory()
|
||||||
love.graphics.setCanvas()
|
love.graphics.setCanvas()
|
||||||
|
|
||||||
|
|
||||||
end
|
end]]
|
||||||
end
|
end
|
||||||
|
|
||||||
function marble.Draw()
|
function marble.Draw()
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
4
wave.lua
4
wave.lua
|
@ -47,7 +47,7 @@ local shader = love.graphics.newShader([[
|
||||||
p.y = -p.y;
|
p.y = -p.y;
|
||||||
|
|
||||||
float r = r( atan(p.y, p.x) ) - length( p );
|
float r = r( atan(p.y, p.x) ) - length( p );
|
||||||
float q = float( r < 0.01 ) * clamp( 1.0 - score, 0.0, 1.0 ) ;
|
float q = float( r < 0.05) * clamp( 1.0 - score, 0.0, 1.0 ) ;
|
||||||
|
|
||||||
return vec4( q + (1.0 + clamp( score, 0.0, 1.0 ) * r * r * 0.2) * color.xyz, float(r > 0.0) ) ;
|
return vec4( q + (1.0 + clamp( score, 0.0, 1.0 ) * r * r * 0.2) * color.xyz, float(r > 0.0) ) ;
|
||||||
}
|
}
|
||||||
|
@ -150,7 +150,7 @@ end
|
||||||
--Apply bandlimited impulse to wave, adjust free parameters according to game state.
|
--Apply bandlimited impulse to wave, adjust free parameters according to game state.
|
||||||
local function OnImpact( impact, level )
|
local function OnImpact( impact, level )
|
||||||
|
|
||||||
IMPULSESIZE = 1.0 + 9.0 * math.sqrt( level / 120.0 )
|
IMPULSESIZE = 10.0 * math.sqrt( ( level - 2.0) / 120.0 )
|
||||||
SOUNDSPEED = 25 - 10 * level / 120
|
SOUNDSPEED = 25 - 10 * level / 120
|
||||||
DAMPING = 0.02 * ( 1.0 - 0.4 * level / 120 )
|
DAMPING = 0.02 * ( 1.0 - 0.4 * level / 120 )
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue