From 1e85ee23c0c798f650a76abab9fe390e4a7a3cdd Mon Sep 17 00:00:00 2001 From: entar Date: Sat, 7 Jun 2025 21:46:18 +0700 Subject: [PATCH] Spooky fix, fixes for indices --- characters/spooky.json | 18 ++++++++++++++---- modules/states/playstate.lua | 19 ++++++++++++------- modules/types/render.lua | 11 +++++++++-- 3 files changed, 35 insertions(+), 13 deletions(-) diff --git a/characters/spooky.json b/characters/spooky.json index 5e167ff..0621903 100644 --- a/characters/spooky.json +++ b/characters/spooky.json @@ -50,11 +50,15 @@ 0, 0 ], - "fps": 12, - "anim": "idle", + "fps": 24, + "anim": "danceLeft", "indices": [ 0, + 1, 2, + 3, + 4, + 5, 6 ], "name": "spooky dance idle" @@ -65,13 +69,19 @@ 0, 0 ], - "fps": 12, + "fps": 24, "anim": "danceRight", "indices": [ + 7, 8, + 9, 10, + 11, 12, - 14 + 13, + 14, + 15, + 0 ], "name": "spooky dance idle" }, diff --git a/modules/states/playstate.lua b/modules/states/playstate.lua index a43537e..ea3f828 100644 --- a/modules/states/playstate.lua +++ b/modules/states/playstate.lua @@ -297,7 +297,7 @@ local function state(songName, songDifficulty) -- gf:PlayAnimation("BF NOTE LEFT", 30, false) for name, character in next, characters do if not character.singing then - if name == "gf" then + if name == "gf" or character.animInfo.danceLeft then character:PlayAnimation("danceLeft") else character:PlayAnimation("idle") @@ -314,8 +314,12 @@ local function state(songName, songDifficulty) }) end else - if characters.gf and not characters.gf.singing then - characters.gf:PlayAnimation("danceRight") + for name, character in next, characters do + if not character.singing then + if name == "gf" or character.animInfo.danceLeft then + character:PlayAnimation("danceRight") + end + end end end @@ -348,9 +352,9 @@ local function state(songName, songDifficulty) myTypes.updateSprites(dt) for name, character in next, characters do - if name ~= "gf" and character.sprite.animation ~= "idle" and character.sprite.ended then + if name ~= "gf" and character.animInfo.idle and character.sprite.animation ~= "idle" and character.sprite.ended then character:PlayAnimation("idle") - elseif name == "gf" and character.singing and character.sprite.animation ~= "danceLeft" and character.sprite.ended then + elseif (name == "gf" or character.animInfo.danceLeft) and character.singing and character.sprite.animation ~= "danceLeft" and character.sprite.ended then character:PlayAnimation("danceLeft") end end @@ -564,7 +568,8 @@ local function state(songName, songDifficulty) if chart.player2 ~= "none" then -- you can have no player2 but always player1 characters.dad = myTypes.character(chart.player2) characters.dad.stagePosition = myTypes.Vector2(stage.opponent[1], stage.opponent[2]) - characters.dad:PlayAnimation("idle") + + characters.dad:PlayAnimation(characters.dad.animInfo.idle and "idle" or "danceLeft") local image = love.graphics.newImage(string.format("images/icons/icon-%s.png", characters.dad.icon)) icons.dad = {image = image, alive = love.graphics.newQuad(0,0, 150, 150, image), dead = love.graphics.newQuad(150, 0, 150, 150, image)} end @@ -683,7 +688,7 @@ local function state(songName, songDifficulty) voices:pause() end pauseStart = socket.gettime() * 1000 - + local pauseStamp = os.time() discord.updatePresence({ details = string.format("Paused %s on difficulty %s", songName, songDifficulty), diff --git a/modules/types/render.lua b/modules/types/render.lua index 525d548..daa9072 100644 --- a/modules/types/render.lua +++ b/modules/types/render.lua @@ -87,11 +87,18 @@ function module.Sprite(image, sheet) end end -function Sprite:PlayAnimation(name, fps, loop) +function Sprite:PlayAnimation(name, fps, loop, allowed) self.animation = name self.fps = fps self.looping = loop - self.frame = 1 + + if self.allowedFrames then + self.allowedFrame = 1 + else + self.frame = 0 + end + + self.ended = false end