diff --git a/src/love/modules/constants.lua b/src/love/modules/constants.lua index ad109a13..b18a99cc 100644 --- a/src/love/modules/constants.lua +++ b/src/love/modules/constants.lua @@ -52,6 +52,17 @@ CONSTANTS.WEEKS = { ["bounceIn"] = "in-bounce", ["bounceOut"] = "out-bounce", ["bounceInOut"] = "in-out-bounce" + }, + COUNTDOWN_SOUNDS = { + "go", + "one", + "two", + "three" + }, + COUNTDOWN_ANIMS = { + "go", + "set", + "ready" } } diff --git a/src/love/modules/graphics.lua b/src/love/modules/graphics.lua index c6c0bcab..8a0281ef 100644 --- a/src/love/modules/graphics.lua +++ b/src/love/modules/graphics.lua @@ -398,38 +398,36 @@ return { beat = function(self, beat) local beat = math.floor(beat) or 0 if self.isCharacter then - if beatHandler.onBeat() then - if not self.danceIdle then - if (not self:isAnimated() and util.startsWith(self:getAnimName(), "sing")) or (self:getAnimName() == "idle" or self:getAnimName() == "idle loop") then - if beat % self.danceSpeed == 0 then - if self.lastHit > 0 then - if beat % math.max(self.danceSpeed, 2) == 0 and self.lastHit + beatHandler.stepCrochet * self.singDuration <= musicTime then - self:animate("idle", false, function() - if self:isAnimName("idle loop") then - self:animate("idle loop", true) - end - end) - self.lastHit = 0 - end - elseif beat % self.danceSpeed == 0 then + if not self.danceIdle then + if (not self:isAnimated() and util.startsWith(self:getAnimName(), "sing")) or (self:getAnimName() == "idle" or self:getAnimName() == "idle loop") then + if beat % self.danceSpeed == 0 then + if self.lastHit > 0 then + if beat % math.max(self.danceSpeed, 2) == 0 and self.lastHit + beatHandler.stepCrochet * self.singDuration <= musicTime then self:animate("idle", false, function() if self:isAnimName("idle loop") then self:animate("idle loop", true) end end) + self.lastHit = 0 end + elseif beat % self.danceSpeed == 0 then + self:animate("idle", false, function() + if self:isAnimName("idle loop") then + self:animate("idle loop", true) + end + end) end end - else - if beat % self.danceSpeed == 0 then - if (not self:isAnimated() and util.startsWith(self:getAnimName(), "sing")) or (self:getAnimName() == "danceLeft" or self:getAnimName() == "danceRight" or (not self:isAnimated() and self:getAnimName() == "sad")) then - self.danced = not self.danced - if self.danced then - self:animate("danceLeft", false) - else - self:animate("danceRight", false) - end - end + end + else + if beat % self.danceSpeed == 0 then + if (not self:isAnimated() and util.startsWith(self:getAnimName(), "sing")) or (self:getAnimName() == "danceLeft" or self:getAnimName() == "danceRight" or (not self:isAnimated() and self:getAnimName() == "sad")) then + self.danced = not self.danced + if self.danced then + self:animate("danceLeft", false) + else + self:animate("danceRight", false) + end end end end diff --git a/src/love/states/weeks.lua b/src/love/states/weeks.lua index 1e7b92e2..e6840845 100644 --- a/src/love/states/weeks.lua +++ b/src/love/states/weeks.lua @@ -40,6 +40,8 @@ local ratingTimers = {} local useAltAnims local option = "normal" +local countNum = 4 -- Used for countdown + return { enter = function(self, option) playMenuMusic = false @@ -486,62 +488,48 @@ return { end, -- Gross countdown script - setupCountdown = function(self) + setupCountdown = function(self, countNumVal) + local countNumVal = countNumVal or 4 lastReportedPlaytime = 0 - musicTime = (240 / bpm) * -1000 - + musicTime = ((60*4) / bpm) * -1000 -- countdown is 4 beats long musicThres = 0 countingDown = true - countdownFade[1] = 0 - audio.playSound(sounds.countdown.three) - Timer.after( - (60 / bpm), - function() - countdown:animate("ready") - countdownFade[1] = 1 - audio.playSound(sounds.countdown.two) - Timer.tween( - (60 / bpm), - countdownFade, - {0}, - "linear", - function() - countdown:animate("set") - countdownFade[1] = 1 - audio.playSound(sounds.countdown.one) - Timer.tween( - (60 / bpm), - countdownFade, - {0}, - "linear", - function() - countdown:animate("go") - countdownFade[1] = 1 - audio.playSound(sounds.countdown.go) - Timer.tween( - (60 / bpm), - countdownFade, - {0}, - "linear", - function() - countingDown = false - - previousFrameTime = love.timer.getTime() * 1000 - musicTime = 0 - beatHandler.reset(0) - - if inst then inst:play() end - if voicesBF then voicesBF:play() end - if voicesEnemy then voicesEnemy:play() end - end - ) - end - ) + if girlfriend then girlfriend:beat(countNumVal) end + if boyfriend then boyfriend:beat(countNumVal) end + if enemy then enemy:beat(countNumVal) end + if CONSTANTS.WEEKS.COUNTDOWN_SOUNDS[countNumVal] then audio.playSound(sounds.countdown[CONSTANTS.WEEKS.COUNTDOWN_SOUNDS[countNumVal]]) end + if countNumVal == 4 then + countdownFade[1] = 0 + Timer.after( + (60/bpm), -- one beat + function() + self:setupCountdown(countNumVal - 1) + end + ) + else + countdownFade[1] = 1 + countdown:animate(CONSTANTS.WEEKS.COUNTDOWN_ANIMS[countNumVal]) + Timer.tween( + (60/bpm), + countdownFade, + {0}, + "linear", + function() + if countNumVal ~= 1 then self:setupCountdown(countNumVal - 1) + else + countingDown = false + previousFrameTime = love.timer.getTime() * 1000 + musicTime = 0 + beatHandler.reset(0) + + if inst then inst:play() end + if voicesBF then voicesBF:play() end + if voicesEnemy then voicesEnemy:play() end end - ) - end - ) + end + ) + end end, update = function(self, dt) @@ -731,9 +719,11 @@ return { if enemy then enemy:update(dt) end if boyfriend then boyfriend:update(dt) end - if boyfriend then boyfriend:beat(beatHandler.getBeat()) end - if enemy then enemy:beat(beatHandler.getBeat()) end - if girlfriend then girlfriend:beat(beatHandler.getBeat()) end + if beatHandler.onBeat() then + if boyfriend then boyfriend:beat(beatHandler.getBeat()) end + if enemy then enemy:beat(beatHandler.getBeat()) end + if girlfriend then girlfriend:beat(beatHandler.getBeat()) end + end end, judgeNote = function(self, msTiming) diff --git a/src/love/weeks/week6.lua b/src/love/weeks/week6.lua index 3c888bc2..a519a44d 100644 --- a/src/love/weeks/week6.lua +++ b/src/love/weeks/week6.lua @@ -70,7 +70,7 @@ return { elseif song == 2 then inst = love.audio.newSource("songs/roses/Inst" .. (hasErect and "-erect" or "") .. ".ogg", "stream") voicesBF = love.audio.newSource("songs/roses/Voices-bf" .. (hasErect and "-pixel-erect" or "") .. ".ogg", "stream") - voicesEnemy = love.audio.newSource("songs/roses/Voices-senpai-angry" .. (hasErect and "-erect" or "") .. ".ogg", "stream") + voicesEnemy = love.audio.newSource("songs/roses/Voices-senpai" .. (hasErect and "-angry-erect" or "") .. ".ogg", "stream") else inst = love.audio.newSource("songs/senpai/Inst" .. (hasErect and "-erect" or "") .. ".ogg", "stream") voicesBF = love.audio.newSource("songs/senpai/Voices-bf" .. (hasErect and "-pixel-erect" or "") .. ".ogg", "stream")