From 5dfd415d3bfe48841a7d2dd72cf1de37e2b35ac1 Mon Sep 17 00:00:00 2001 From: yaw-man Date: Fri, 27 Jan 2023 23:17:46 -0400 Subject: [PATCH] Final commit before post-jam release, "1.0.0"? New features since last release: - Display score breakdown, high score, and letter grades. - Options menu with volume control, keybindings, and true fullscreen. - Demos menu. View saved games! - Mouse controls, sorta. Mouse controlled menus! - High contrast mode. - Instructions displayed on startup. - Default demo ships with game. - Render sitelen pona quote symbols to and te - Beat combo indicator. Outstanding defects: - Options menu not persistent. - Mouse controls feel like complete dogshit. --- conf.lua | 1 - demos/yam.yod | Bin 0 -> 135552 bytes loadgame.lua | 31 +++++++++++---- main.lua | 25 +++++++++---- marble.lua | 3 ++ mousecontrols.lua | 36 ++++++++++++------ options.lua | 73 ++++++++++++++++++++++++++++++------ recorder.lua | 8 ++-- scores.lua | 91 +++++++++++++++++++++++++++++++++++++-------- sitelenpona.lua | 4 +- sitelenpona/te.png | Bin 0 -> 1083 bytes sitelenpona/to.png | Bin 0 -> 1066 bytes text.lua | 48 +++++++++++++++++++----- wave.lua | 20 ++++++---- 14 files changed, 261 insertions(+), 79 deletions(-) create mode 100644 demos/yam.yod create mode 100644 sitelenpona/te.png create mode 100644 sitelenpona/to.png diff --git a/conf.lua b/conf.lua index a262028..a2718b9 100644 --- a/conf.lua +++ b/conf.lua @@ -1,7 +1,6 @@ function love.conf( t ) t.version = "11.4" t.identity = "Your Own Drum" - t.console = true t.modules.joystick = false t.modules.physics = false diff --git a/demos/yam.yod b/demos/yam.yod new file mode 100644 index 0000000000000000000000000000000000000000..e48429b225fbe7e1df87113160c768b45ce6b4dd GIT binary patch literal 135552 zcmeI5!Fl913`X5W&Z!~C946JIhTPIYO4!c@q=#uBW#rqlONeC>Yv7kB8cC!`N-u|@ znXx45;Rgsn+TGW`{`mIyzrXzU)6Xvh{P%W?i(Ehd=hr`f|MvR*p2r(=c%TRT;VkiB zDL%@5TKp?Ert7bd%S-F#drttqp2o`yJmBF8pa)L_|9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)zj!PE|yxK#8=C^Exw+9E*xidLgr%}4j zasG+Gc79oZmyHwXXP?C-7$b=;kr+ zKc{`ZLY(U(&XFgOC%8VG#jC}`^x{HdF(&KLwJZT zPrDCizv2FZ!Q1Ea5~s{Ri;bh(UHIIXlTW_qG3FoD^$^0vj`vvOd34sUKbifhI!F8# Jzun@u{{cdZp?&}W literal 0 HcmV?d00001 diff --git a/loadgame.lua b/loadgame.lua index ee93227..2981d15 100644 --- a/loadgame.lua +++ b/loadgame.lua @@ -1,17 +1,18 @@ --UI for selecting a saved game. local love = love local loadGame = {} -local _Update = love.update -local _Draw = love.draw -local _MousePressed = love.mousepressed -local _Resize = love.resize -local _KeyPressed = love.keypressed -love.mouse.setRelativeMode( false ) +local _Update +local _Draw +local _MousePressed +local _MouseMoved +local _Resize +local _KeyPressed local function RestoreMainState() love.update = _Update love.draw = _Draw love.mousepressed = _MousePressed + love.mousemoved = _MouseMoved love.keypressed = _KeyPressed love.resize = _Resize love.mousemoved = nil @@ -32,7 +33,7 @@ local OnClick local function DeleteLeft() - return w * 0.75 + 15 + 6 + return love.graphics.getWidth() * 0.75 + 15 + 6 end local function DeleteRight() @@ -46,6 +47,8 @@ end local function PopulateGameList() scrollOffset = 0 gameList = assert( love.filesystem.getDirectoryItems( "demos" ) ) + + local w, h = love.graphics.getDimensions() canvas = love.graphics.newCanvas( w, h * (1 + #gameList) / 10.0 ) love.graphics.setCanvas( canvas ) @@ -74,7 +77,11 @@ end local updateLoadMenu = function() end local drawLoadGameMenu = function() + local w, h = love.graphics.getDimensions() love.graphics.setColor( 1, 1, 1, 1 ) + if options["high contrast"].value then + love.graphics.setColor( 0,0,0, 1 ) + end love.graphics.draw( canvas, 0, 15 - scrollOffset * h / 10 ) @@ -156,10 +163,18 @@ end local wheelMoved = function(x, y) - scrollOffset = math.max( 0, math.min( #gameList, scrollOffset - y * 0.1 ) ) + --scrollOffset = math.max( 0, math.min( #gameList, scrollOffset - y * 0.1 ) ) end local function LoadGameMenu() + _Update = love.update + _Draw = love.draw + _MousePressed = love.mousepressed + _MouseMoved = love.mousemoved + _Resize = love.resize + _KeyPressed = love.keypressed + love.mouse.setRelativeMode( false ) + love.wheelmoved = wheelMoved love.mousemoved = mouseMoved love.draw = drawLoadGameMenu diff --git a/main.lua b/main.lua index 5ff4a22..9f5971a 100644 --- a/main.lua +++ b/main.lua @@ -160,6 +160,7 @@ function love.load() end + loadGame = assert( require "loadgame" ) options = assert( require( "options" ) ) mouseControl = assert( require "mousecontrols" ) sitelenpona = assert( require "sitelenpona" ) @@ -231,7 +232,7 @@ OnVictory = function() state.isDemo = false else scores.Save() - recorder.Save() + recorder.Save( scores.Get(), state.tick) end particles:setParticleLifetime( 0, 30 ) @@ -262,6 +263,7 @@ OnVictory = function() marble.Update() wave.Update() + dt = dt - step end @@ -331,6 +333,11 @@ Update = function( dt ) while dt > step do state.tick = state.tick + 1 + + if mouseControl.isActive then + mouseControl.update() + marble.SetAcceleration( mouseControl.getAcceleration() ) + end if state.isDemo then local ddx, ddy = recorder.NextTick() @@ -363,8 +370,10 @@ local function OptionsMenu() end local function LoadGame() -- Load game screen. - if not loadGame then loadGame = assert( require "loadgame" ) end + local Click, Press = assert(loadGame.OnClick), assert(loadGame.KeyPress) + loadGame.LoadGameMenu() + love.mousepressed = function( x, y, button, istouch, presses) local demoName = Click( x, y, button, istouch, presses ) if demoName then return NewGame( demoName ) end @@ -375,7 +384,7 @@ local function LoadGame() -- Load game screen. if demoName then return NewGame( demoName ) end end - loadGame.LoadGameMenu() + end function love.keypressed( key, code, isRepeat ) @@ -385,6 +394,7 @@ function love.keypressed( key, code, isRepeat ) if code == "o" then return OptionsMenu() end if state.isDemo then return end + mouseControl.isActive = false return marble.OnKey( love.keyboard.isScancodeDown( options.up.value ), love.keyboard.isScancodeDown( options.left.value ), @@ -395,10 +405,10 @@ end function love.keyreleased( key, code ) return marble.OnKey( - love.keyboard.isScancodeDown( options.up.value ), - love.keyboard.isScancodeDown( options.left.value ), - love.keyboard.isScancodeDown( options.down.value ), - love.keyboard.isScancodeDown( options.right.value ) ) + love.keyboard.isScancodeDown( options.up.value), + love.keyboard.isScancodeDown( options.left.value), + love.keyboard.isScancodeDown( options.down.value), + love.keyboard.isScancodeDown( options.right.value) ) end function love.resize( w, h ) @@ -408,6 +418,7 @@ end --TODO: make this feel better. function love.mousemoved( x, y, dx, dy, number, istouch ) + mouseControl.isActive = true dx, dy = mouseControl.mousemoved( dx, dy ) if dx then return marble.SetAcceleration( dx, dy ) end end diff --git a/marble.lua b/marble.lua index 468f36b..9a35c02 100644 --- a/marble.lua +++ b/marble.lua @@ -84,6 +84,9 @@ function marble.Update() oldState[k] = curState[k] curState[k] = newState[k] end + + --Inertia. + --ddx, ddy = ddx * 0.95, ddy * 0.95 end diff --git a/mousecontrols.lua b/mousecontrols.lua index e57e7c0..130f2e3 100644 --- a/mousecontrols.lua +++ b/mousecontrols.lua @@ -1,25 +1,37 @@ -local mouseControl = {} +local mouseControl = { isActive = false } local love = love -local t = love.timer.getTime() +local x, y = 0, 0 + +local DECAY = 0.8 +local SENSITIVITY = 0.8 function mouseControl.Reset() - t = love.timer.getTime() + x, y = 0, 0 end function mouseControl.mousemoved( dx, dy ) - local dt = love.timer.getTime() - if dt - t < 1 / 1000.0 then return end - dt, t = dt - t, dt + + dx, dy = SENSITIVITY * dx, SENSITIVITY * dy + dx, dy = dx * dx * dx , dy * dy * dy + x, y = dx + x, y - dy - dx, dy = dx * dt, -dy * dt - local norm = math.sqrt( dx * dx + dy * dy ) - if norm > 1 then dx, dy = dx / norm, dy / norm end - - if norm < 0.01 then return 0, 0 end - return dx, dy + return mouseControl.getAcceleration() + end +function mouseControl.update() + local norm = math.sqrt( x * x + y * y ) + local decay = DECAY * norm / ( norm + 1 ) + x, y = decay * x, decay * y +end + +function mouseControl.getAcceleration() + local norm = math.sqrt( x * x + y * y ) + if norm > 1 then return x / norm, y / norm end + if norm < 0.001 then return 0, 0 end + return x, y +end return mouseControl \ No newline at end of file diff --git a/options.lua b/options.lua index 7fea86b..c00768f 100644 --- a/options.lua +++ b/options.lua @@ -16,22 +16,31 @@ if not options.initialized then options.initialized = true local keyBindCallback = function(self, code) - self.value = code + self.value = code or self.value end options.optionValues = { { name = "options", - value = "back", + value = "", callback = function(self) - return ExitMenu() + end + }, + + { name = "fullscreen", + value = false, + callback = function(self) + self.value = not(self.value) + love.window.setFullscreen( self.value ) + love.event.push( "resize", love.graphics.getWidth(), love.graphics.getHeight() ) end }, { name = "high contrast", value = false, callback = function(self, code) - if code == "return" or code == "backspace" then return end + if code == "backspace" then return end self.value = not( self.value ) + return false end }, @@ -43,8 +52,9 @@ if not options.initialized then if (code == "left" or code == "a") then isIncreasing = -1 elseif (code == "right" or code == "d") then isIncreasing = 1 else return false end - self.value = math.max( 0, math.min( 1, + self.value = math.max( 0, math.min( 2, self.value + (isIncreasing * 0.05 ))) + love.audio.setVolume( self.value ) return true end @@ -85,6 +95,9 @@ local isAwaitingKey = false local font = love.graphics.newFont( 32 ) local function Draw() love.graphics.setColor( 1,1,1,1 ) + if options["high contrast"].value then + love.graphics.setColor( 0, 0, 0, 1 ) + end for i, option in ipairs( options.optionValues ) do love.graphics.printf( option.name, font, 100, i * 50, 1000, "left") love.graphics.printf( tostring( option.value ), font, -100, i * 50, love.graphics.getWidth(), "right") @@ -94,7 +107,7 @@ local function Draw() local w = love.graphics.getWidth() - love.graphics.setColor( 1,1,1,0.5 ) + love.graphics.setColor( 1,1,1,0.5 ) if isAwaitingKey then love.graphics.rectangle( "fill", w - 200, optionIdx * 50, 100, 48, 10, 10 ) else @@ -113,21 +126,53 @@ local function SelectPreviousOption() option = options.optionValues[ optionIdx] end +local function MouseMoved( x, y ) + optionIdx = + math.min( #options.optionValues, + math.max( 1, + math.floor( y / 50 ) + )) + option = options.optionValues[ optionIdx] + + if ( x > love.graphics.getWidth() - 200 ) then + isAwaitingKey = true + else + isAwaitingKey = false + end +end + + local function KeyPress(key, code, isRepeat) - if code == "backspace" then return ExitMenu() end - if isAwaitingKey then - + if not( isAwaitingKey ) then + + if code == "backspace" then + return ExitMenu() end + if optionIdx and + code == "return" or + code == "right" then + isAwaitingKey = true + return + end + + if code == "down" then return SelectNextOption() end + if code == "up" then return SelectPreviousOption() end + + else + if code == "backspace" then isAwaitingKey = false end if code == "escape" then return end isAwaitingKey = (options.optionValues[optionIdx]):callback( code ) end - if code == "return" and optionIdx then isAwaitingKey = true; return end - if code == "down" then return SelectNextOption() end - if code == "up" then return SelectPreviousOption() end + +end + + +local function MousePressed( ) + return KeyPress( ) end local function EnterMenu() @@ -136,13 +181,17 @@ local function EnterMenu() mousepressed = love.mousepressed keypressed = love.keypressed mousemoved = love.mousemoved + love.mouse.setRelativeMode( false ) love.draw = Draw love.keypressed = KeyPress love.update = function() end + love.mousemoved = MouseMoved + love.mousepressed = MousePressed end function ExitMenu() + love.mouse.setRelativeMode( true ) love.mousemoved = mousemoved love.keypressed = keypressed love.mousepressed = mousepressed diff --git a/recorder.lua b/recorder.lua index 6c5dcde..3483ec5 100644 --- a/recorder.lua +++ b/recorder.lua @@ -6,7 +6,7 @@ local ddxs, ddys local i = 0 function recorder.Reset() - i = 0 + i = 1 for k, _ in ipairs( recorder ) do recorder[k] = nil end end @@ -30,7 +30,8 @@ function recorder.Load( filename ) ddxs, ddys = {}, {} local s = love.filesystem.read( filename ) if not s then return end - local k, j = 1, 1 + local j = 1 + local score, ticks, k = love.data.unpack( "!16 threshold then streakTier = i end + end + + for i, threshold in ipairs( letters.score ) do + if score > threshold then scoreTier = i end + end + + return letters.letters[ticksTier], letters.letters[streakTier], letters.letters[scoreTier] +end + function scores.OnImpact( tick, isHitSuccessful ) local score = 0 if isHitSuccessful then scores.streak = scores.streak + 1 + scores.longestStreak = math.max( scores.streak, scores.longestStreak ) else table.insert( scores.streaks, scores.streak) scores.streak = 0 end - + for i, streak in ipairs( scores.streaks ) do - score = score + streak * streak + score = score + math.pow( streak, 1.7 ) end - - scores.score = score / math.pow( tick / 120.0, 1.5 ) + + scores.score = score / ( ( tick / 120.0 ) - 36.0 ) scores.t = tick end function scores.Reset() scores.score = 0 scores.streak = 0 + scores.longestStreak = 0 + scores.highScore = scores.LoadHighScores() scores.streaks = {} end function scores.Get() - + return scores.score end function scores.Save() @@ -36,24 +66,53 @@ function scores.Save() if highScores[j] < scores.score then break end end table.insert( highScores, i ) + scores.highScore = math.max( scores.score, scores.highScore ) end function scores.LoadHighScores() - + local gameList = assert( love.filesystem.getDirectoryItems( "demos" ) ) + local highScore = 0 + for i, name in ipairs( gameList ) do + local s = love.filesystem.read( "demos/"..name, 64 ) + if ( s:len() > 32 ) then + local gamescore, gameticks = love.data.unpack( "!162 zLTEv#0E??YVe$9ui9+wQxpXhxD=4m?Q-1#GQ??K3C22QmJr5Yj&huTq|^1W}Q^(67jwg6^zch1yL$2`|w3YogfZI@Sn z->e(I|JUBSb!LmX?G&b8@v+~FnK<4t_wIWAZ{DuF$2=T+7_O(?j$dedwsvw{e)h&> zg+0tM_qLcmW!Q0x_1HY!nWud<9bR5HdGMG?LXTnb_X7`hZC`!O^4$D}KW2XySwHx| zF=NTU569&9^{2mi(K00%7z3OI9+AZi4BSE>%y{W;-5&-9rXo)l$B>F!Z?7NZZB}4# z2sC*2m}BnAUMnu;8@w_Lr2{;wjN~jtI$u_E8dhECc^8s?QDLQ8mFC)2i;(814VC-|Y|Mn$(2 zLTEv#0E??YVe$9ui9+wQxpXhxD=4m?Q-1#GQ??K3C22QmJr5Yj&huTq|^1W}Q^(67jwg6^zch1yL$2`|w3YogfZI@Sn z->e(I|JUBSb!LmX?G&b8@v+~FnK<4t_wIWAZ{DuF$2=T+7_O(?j$dedwsvw{e)h&> zg+0tM_qLcmW!Q0x_1HY!nWud<9bR5HdGMG?LXTnb_X7`hZC`!O^4$D}KW2XySwHx| zF=NTU569&9^{2mi(K00%7z3OI9+AZi4BSE>%y{W;-5&-9rbJH{$B>F!Z?9kEbO;b> zNIc2lwt-Pu;;33!vhZw~@VlQ>;xuaF=f0CJ&HG#0%>*hlHchzn?8Nu5ZpD>;)ozLlDwnXx- xb_EkdeI-+h_pF<<9!|3I&E`c;5~%DCR@xG8CC_l>S=|Lmc)I$ztaD0e0suo&9Etz{ literal 0 HcmV?d00001 diff --git a/text.lua b/text.lua index 722ddb6..85310ee 100644 --- a/text.lua +++ b/text.lua @@ -10,7 +10,7 @@ local poemLines = {[0] = 0} local mt = { __index = function() return "linja" end } local s = love.filesystem.read( "text/tok.txt" ) -local instrFont = love.graphics.newFont( 18 ) +local instrFont = love.graphics.newFont( 24 ) local enFont = love.graphics.setNewFont( "text/yod-linja-sike.ttf", 18 ) local smallFont = love.graphics.setNewFont( "text/yod-linja-sike.ttf", 24 ) local largeFont = love.graphics.setNewFont( "text/yod-linja-sike.ttf", 64 ) @@ -60,30 +60,52 @@ local function Draw( beat ) local foot = feet[ beat ] if beat == 1 then - love.graphics.setColor(1.0, 1.0, 1.0, 1.0) + + love.graphics.setColor(0, 0, 0, 0.5) + if options["high contrast"].value then + love.graphics.setColor( 1, 1, 1, 1 ) + end + + love.graphics.rectangle( "fill", + 0.5 * love.graphics.getWidth() - 250, 10, + 500, 1.1 * largeFont:getHeight(), 10, 10 ) + + love.graphics.rectangle( "fill", + 0.5 * love.graphics.getWidth() - 200, love.graphics.getHeight() - 5.25 * instrFont:getHeight(), + 400, 4.5 * instrFont:getHeight(), 50, 50 ) + + love.graphics.setColor(1.0, 1.0, 1.0, 1.0 ) + if options["high contrast"].value then + love.graphics.setColor( 0, 0, 0, 1 ) + end love.graphics.printf( "your.own.drum", largeFont, 0, 0, love.graphics.getWidth(), "center" ) + love.graphics.printf( [[ -wasd move -space restart -return recall -o options]], +WASD MOVE +SPACE RESTART +RETURN DEMOS +O OPTIONS]], instrFont, - 0, love.graphics.getHeight() - 4 * instrFont:getHeight(), - love.graphics.getWidth(), - "left" + 0.5 * love.graphics.getWidth() - 150, love.graphics.getHeight() - 5 * instrFont:getHeight(), + 300, + "justify" ) + return end love.graphics.setColor(1.0, 1.0, 1.0, 0.5) + if options["high contrast"].value then + love.graphics.setColor( 0, 0, 0, 1 ) + end local lineNumber if poemLines[beat] < 2 then lineNumber = 0 else lineNumber = 2 - poemLines[beat] @@ -96,6 +118,9 @@ o options]], ) love.graphics.setColor(1.0, 1.0, 1.0, 1.0) + if options["high contrast"].value then + love.graphics.setColor( 0, 0, 0, 1 ) + end love.graphics.printf( foot, largeFont, 0, 0.87 * love.graphics.getHeight(), @@ -104,6 +129,9 @@ o options]], ) love.graphics.setColor(1.0, 1.0, 1.0, 0.5) + if options["high contrast"].value then + love.graphics.setColor( 0, 0, 0, 1 ) + end love.graphics.printf( poemLang[beat], enFont, -8, 0,--(2 - poemLines[beat]) * smallFont:getHeight(), @@ -115,7 +143,7 @@ o options]], end s = love.filesystem.read( "text/en.txt" ) -i = 1 +i = 0 --Split string into lines. for line in s:gmatch( ".-\n") do diff --git a/wave.lua b/wave.lua index 7638254..c7040e5 100644 --- a/wave.lua +++ b/wave.lua @@ -149,7 +149,7 @@ end --Apply bandlimited impulse to wave, adjust free parameters according to game state. local function OnImpact( impact, level ) - + IMPULSESIZE = 10.0 * ( level - 2.0) / 120.0 SOUNDSPEED = 25 - 10 * level / 120 DAMPING = 0.01 * ( 1.0 - 0.4 * level / 120 ) @@ -201,7 +201,11 @@ local function Draw( score ) -- Blue circle. love.graphics.setColor( 91 / 255, 206 / 255, 250 / 255 ) - + --Black circle. + if options["high contrast"].value then + love.graphics.setColor( 0, 0, 0 ) + end + shader:send( "re", unpack( cur.dftre ) ) shader:send( "im", unpack( cur.dftim ) ) shader:send( "score", score ) @@ -255,7 +259,7 @@ local function Draw( score ) local r = cur:Interpolate( t ) local x, y = r * math.cos( t ), r * math.sin( t ) love.graphics.circle( "fill", x, y, 0.02 )]] - + end @@ -279,12 +283,12 @@ end Integrate = function( step ) for i = 1, N do - + local rxx = cur:SecondDerivative( math.pi * 2.0 * ( i - 1 ) / N ) - + local r = ( 1.0 - DAMPING ) * ( 2.0 * cur.radii[i] - old.radii[i] + step * step * SOUNDSPEED * rxx ) --Verlet + DAMPING --Damping: oscillate toward 1. - + --Avoid explosions. r = math.max( 0.5, math.min( r, 4.0 ) ) new.radii[i] = r @@ -299,11 +303,11 @@ local function DetectCollision( px, py, vpx, vpy ) end local function Reset() - + IMPULSESIZE = 1 / 10.0 SOUNDSPEED = 5.0 DAMPING = 0.1 / 1 - + old = Wave() cur = Wave() new = Wave()