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!L{Wy42Gu**3`g~1yn-~?C5|J=DY&vfd-}w4(lm_6C}Nnl$XhkV>@>8Y2zbu zlQ^G#$#U*}!`q*~fBx&ApML$}$4?X3*I(i!kNaPK{^PgLZ~y+SBR)LP1Nm^9dazd? zQ{AiX%l(hn<-K`x+#7s7jZg4^M=*E<9PoIVM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ekm~EK?*(n%(~S}b`hC-5ZyxlI*Y=O_zc>Gs z*VFlFeeCXQJ)Dl)>~VkU{FC0TpEBL!OTC82P1dcl`g+vp?<2A2@VHB!Q1|}t)2aJ6 zsrx&6wm3H*%hn(E18F_M4+f8b10L0Q?9|P@x_bI}itEZx>(g+)%zr)az31Y%x9j*N zeOZ5CI>UcPe|Xz?`z)Jb-AwDz@V@Y^w;pr7#o(zzP%Gz=^69p9j&x-($NT@7cjbM6*zxm|PP+T0^S+uJ_xE;OcXoEtA9ZVzx~21ce7sD@ zV(UIBaXRd8U3c%k9QU@4i$8ki?^RQL$qV}3q5glTPmf2+^TWRKV~l-CHy&r>clP|& z&n@%Y)@8cC^$#{L{HRNKz++i|-}58oe|KNw(QMTEQT$wKe(&7wqN5al{9y11I6mN! z@}Rpf^CM1sapJf)^x|oJl-C^hR<4&+9}o8peikL~;Zpxn-Iw{5_g9?1SUY|x{mBqL|JiMU?Ph;l&Nvf}p>$_4M zSAOchy8AM}^}P1x&2ewr{8D_azpyytv;VmD{=;Xk`m0D79`NusyB_we zcD>?ykvKfy;q99qQh#cF9%Fnj3J-Yr_r&jdkgWQaPhRI@R)?>#=UO{JWu9^yRDBN8fv==UDk#zjm*)cc0SZX@1ji*LgGFi|bI* z9eyx)1RM=`q&iUDm-){d$Ha%aIq5$8>N;O~|CIkH{Vh9t-SYEGxuC;2-*?Rx@BaWo CilKf0 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( "!16~iLIb(C4!6uZhf`rs<>PqVf-O=_DiqPecA+xehl$;a#u z_7_46LIqe{1qzG5XHOJ*pUtIv>0Uu`{hadiPoJ`VNH0mdQR{iYKz5$*@+DUf%@V0; z=MOx^;g*sX?Y;A;P1UjU%B4XzDo57btBp-wvEmlb2VQ~mM%~s&J|CH>dt7LbyG&y0 zPLCQVndc>rkD?c9%kAgXtNf!ntGjciemds4_EN~yRc^by z`uk?x`2D~3)~z#J%x$MI{fdwMUd+Vtj=6W&>woihCQautLgCay2*pbOcHtwi@zUuuxtD3YnJEcH~caCyU6;% z2aXv_{(U$mzpp?2&5M>P!3+!xoCO|{#S9GGLLkg|>2BR01_q`gPZ!6Kid%25ALMOT zU~mXDc=woN?#W&&F6A4%G7F^xJgSW3EJQkAR&yFwUFdk|?!Q(YK-=O*zfj-aZPH@GPzlAw(~jM{4cM6_2~Sn zx0wvl3=W{w!onZ`VIVQ#Vw5l(7~iLIb(C4!6uZhf`rs<>PqVf-O=_DiqPecA+xehl$;a#u z_7_46LIqe{1qzG5XHOJ*pUtIv>0Uu`{hadiPoJ`VNH0mdQR{iYKz5$*@+DUf%@V0; z=MOx^;g*sX?Y;A;P1UjU%B4XzDo57btBp-wvEmlb2VQ~mM%~s&J|CH>dt7LbyG&y0 zPLCQVndc>rkD?c9%kAgXtNf!ntGjciemds4_EN~yRc^by z`uk?x`2D~3)~z#J%x$MI{fdwMUd+Vtj=6W&>woihCQautLgCay2*pbOcHtwi@zUuuxtD3YnJEcH~caCyU6;% z2aXv_{(U$mzpp?2&5M>P!3+!xoCO|{#S9GGLLkg|>2BR01_q`?PZ!6Kid%25U*vQM z5NSv}$>6quQCZ@sT3E91Y?<)8pH$*BYU1aS=|K*d%F6$taD0e0suo&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()