diff --git a/audio.lua b/audio.lua index 30b09f7..14b2318 100644 --- a/audio.lua +++ b/audio.lua @@ -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 diff --git a/main.lua b/main.lua index e8d1aa7..f85cdae 100644 --- a/main.lua +++ b/main.lua @@ -12,6 +12,7 @@ local OnImpact local OnVictory local BeatScore local Draw +local Update local ExtrapolateBeatScore local _ExtrapolateBeatScore @@ -64,7 +65,7 @@ OnImpact = function( impact ) if state.currentBeat >= 119 then return OnVictory() end - + end @@ -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() @@ -94,25 +97,29 @@ end function love.load() UpdateWindowTransform( love.graphics.getDimensions() ) - + do--particle system setup particles = love.graphics.newParticleSystem( 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 ) @@ -164,7 +171,7 @@ BeatScore = function( t ) score = score * score * score * score --General case: update average beat length. - + --Debounce: max BPM 200 if dt > 60.0 / 200.0 then @@ -180,23 +187,65 @@ BeatScore = function( t ) 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.draw = function() - love.graphics.setColor( 1, 1, 1, 1 ) - - text.Draw( 119 ) - - love.graphics.printf( - "your.time:\n"..totalTime, - 0, 0.5 * love.graphics.getHeight(), - love.graphics.getWidth(), - "center" - ) - - marble.Draw() + 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( + "time:\n"..string.format( "%.3f", totalTime ):gsub( "%.", "," ), + 0, 0.5 * love.graphics.getHeight() - love.graphics.getFont():getHeight(), + love.graphics.getWidth(), + "center" + ) + + marble.Draw() + end marble.OnVictory() love.graphics.setBackgroundColor( 91 / 255, 206 / 255, 250 / 255 ) --Trans blue. end @@ -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 diff --git a/marble.lua b/marble.lua index 28f94c9..dbf5d60 100644 --- a/marble.lua +++ b/marble.lua @@ -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() diff --git a/sounds/chimewine.flac b/sounds/chimewine.flac new file mode 100644 index 0000000..99832ff Binary files /dev/null and b/sounds/chimewine.flac differ diff --git a/sounds/chimewine432.flac b/sounds/chimewine432.flac new file mode 100644 index 0000000..8bc43aa Binary files /dev/null and b/sounds/chimewine432.flac differ diff --git a/sounds/chimewinedolce.flac b/sounds/chimewinedolce.flac new file mode 100644 index 0000000..8a579b0 Binary files /dev/null and b/sounds/chimewinedolce.flac differ diff --git a/sounds/noiseloop.flac b/sounds/noiseloop.flac new file mode 100644 index 0000000..86cdc04 Binary files /dev/null and b/sounds/noiseloop.flac differ diff --git a/wave.lua b/wave.lua index 9950ee7..609a3b8 100644 --- a/wave.lua +++ b/wave.lua @@ -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 )