Spooky fix, fixes for indices

This commit is contained in:
entar 2025-06-07 21:46:18 +07:00
parent 6e09bb288e
commit 1e85ee23c0
3 changed files with 35 additions and 13 deletions

View File

@ -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"
},

View File

@ -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),

View File

@ -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