Add more sounds, more feedback on victory condition.

This commit is contained in:
yaw-man 2023-01-15 21:47:14 -04:00
parent ae75751f32
commit e600760281
8 changed files with 85 additions and 57 deletions

View File

@ -95,7 +95,7 @@ local function OnImpact( impact, score, pass, level )
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.5))
local highgain = math.max( 0, math.min( score, 1.0 ) - (pass and 0.0 or 0.9))
chime:setFilter{
type = "lowpass",
volume = 0.5 * impact.speed,
@ -111,6 +111,11 @@ local function OnVictory( )
type = "reverb",
volume = 1.0,
decaytime = 20,} )
love.audio.setEffect( "droneReverb", {
type = "reverb",
volume = 1.0,
decaytime = 20,} )
end
--score is the hypothetical "beat score" that would be attained

View File

@ -12,6 +12,7 @@ local OnImpact
local OnVictory
local BeatScore
local Draw
local Update
local ExtrapolateBeatScore
local _ExtrapolateBeatScore
@ -84,7 +85,9 @@ local function NewGame()
OnImpact = _OnImpact
ExtrapolateBeatScore = _ExtrapolateBeatScore
love.draw = Draw
love.update = Update
particles:reset()
particles:setSizes( 0.0007, 0.0001, 0.0003 )
state.Reset()
marble.Reset()
wave.Reset()
@ -100,19 +103,23 @@ function love.load()
love.graphics.newImage( "prideflag.png" ),
1024)
particles:setSizes( 0.00015, 0.0001, 0.00018 )
--particles:setSizes( 0.0007, 0.0001, 0.0003 )
particles:setSizeVariation( 1 )
particles:setRadialAcceleration( 0, 0.5 )
particles:setSpeed( 0.2, 1 )
particles:setLinearDamping( 1, 10 )
particles:setRelativeRotation( true )
particles:setEmitterLifetime( -1 )
particles:setParticleLifetime( 0, 15 )
particles:setParticleLifetime( 0, 5 )
particles:setSpread( 0.05 )
particles:setColors(
1, 1, 1, 1,
91 / 255, 206 / 255, 250 / 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
)
@ -181,16 +188,58 @@ end
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
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.graphics.push( "transform" )
love.graphics.applyTransform( transform )
love.graphics.setColor( 1, 1, 1, 1 )
love.graphics.draw( particles )
love.graphics.pop()
text.Draw( 119 )
love.graphics.setColor( 1, 1, 1, 1 )
love.graphics.printf(
"your.time:\n"..totalTime,
0, 0.5 * love.graphics.getHeight(),
"time:\n"..string.format( "%.3f", totalTime ):gsub( "%.", "," ),
0, 0.5 * love.graphics.getHeight() - love.graphics.getFont():getHeight(),
love.graphics.getWidth(),
"center"
)
@ -207,41 +256,15 @@ Draw = function()
love.graphics.push( "transform" )
love.graphics.applyTransform( transform )
wave.Draw( score )
love.graphics.setColor( 1.0, 1.0, 1.0, 1.0 )
love.graphics.draw(particles, 0, 0)
--[[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]]
wave.Draw( score )
love.graphics.pop()
sitelenpona.Draw( text.words[state.currentBeat] )
marble.Draw()
text.Draw( state.currentBeat )
@ -250,7 +273,7 @@ end
function love.update( dt )
Update = function( dt )
audio.Update( ExtrapolateBeatScore(), state.currentBeat )
particles:update( dt )
@ -275,6 +298,7 @@ function love.update( dt )
end
state.timeToSimulate = dt
end
_Update = Update
function love.keypressed( key, code, isRepeat )
if key == "escape" then return love.event.quit() end

View File

@ -13,7 +13,6 @@ local function State( )
return { t = 0, x = 0, y = 0, dx = 0, dy = 0 }
end
function marble.Current() return curState end
function marble.Next() return newState end
@ -99,7 +98,7 @@ end
function marble.OnVictory()
marble.Draw = function()
--[[marble.Draw = function()
--Extrapolate forward for slightly smoother rendering.
local dt = love.timer.getTime() - curState.t
@ -118,7 +117,7 @@ function marble.OnVictory()
love.graphics.setCanvas()
end
end]]
end
function marble.Draw()

BIN
sounds/chimewine.flac Normal file

Binary file not shown.

BIN
sounds/chimewine432.flac Normal file

Binary file not shown.

BIN
sounds/chimewinedolce.flac Normal file

Binary file not shown.

BIN
sounds/noiseloop.flac Normal file

Binary file not shown.

View File

@ -47,9 +47,9 @@ local shader = love.graphics.newShader([[
p.y = -p.y;
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.
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
DAMPING = 0.02 * ( 1.0 - 0.4 * level / 120 )