diff --git a/modules/types/note.lua b/modules/types/note.lua index 02e32e5..390fb0a 100644 --- a/modules/types/note.lua +++ b/modules/types/note.lua @@ -54,20 +54,25 @@ function NoteClass:Spawn() local sprite = Rect("sprites/NOTE_assets.png", "sprites/NOTE_assets.xml") self.sprite = sprite - sprite.layer = 10 + sprite.layer = 11 local spriteName if self.hold then - sprite.layer = 9 + sprite.layer = 10 sprite.alpha = 0.6 - self.offset.x = 20 + self.offset.x = 45 if self.holdEnd then - sprite.layer = 10 + sprite.layer = 11 spriteName = string.format("%s hold end", sprites[self.direction]) if self.flipY then sprite.extraOffset = Vector2(0, -70) end else spriteName = string.format("%s hold piece", sprites[self.direction]) + if self.flipY then + sprite.extraOffset = Vector2(0, 20) + else + sprite.extraOffset = Vector2(0, -20) + end end else spriteName = sprites[self.direction] diff --git a/modules/types/render.lua b/modules/types/render.lua index 9871312..11f7bec 100644 --- a/modules/types/render.lua +++ b/modules/types/render.lua @@ -104,7 +104,8 @@ function _G.Sprite(image, sheet) rect = false, modifier = 1, layer = 0, - alpha = 1 + alpha = 1, + starterFrame = 0, }, Sprite) for index, sprite in next, atlas do @@ -195,7 +196,7 @@ function Sprite:PlayAnimation(name, fps, loop, allowed) if self.allowedFrames then self.allowedFrame = 1 else - self.frame = 0 + self.frame = self.starterFrame or 0 end self.ended = false diff --git a/sprites/holdCovers/holdCoverBlue.png b/sprites/holdCovers/holdCoverBlue.png new file mode 100644 index 0000000..d610b23 Binary files /dev/null and b/sprites/holdCovers/holdCoverBlue.png differ diff --git a/sprites/holdCovers/holdCoverBlue.xml b/sprites/holdCovers/holdCoverBlue.xml new file mode 100644 index 0000000..4617523 --- /dev/null +++ b/sprites/holdCovers/holdCoverBlue.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sprites/holdCovers/holdCoverGreen.png b/sprites/holdCovers/holdCoverGreen.png new file mode 100644 index 0000000..11f9cc1 Binary files /dev/null and b/sprites/holdCovers/holdCoverGreen.png differ diff --git a/sprites/holdCovers/holdCoverGreen.xml b/sprites/holdCovers/holdCoverGreen.xml new file mode 100644 index 0000000..068cd7e --- /dev/null +++ b/sprites/holdCovers/holdCoverGreen.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sprites/holdCovers/holdCoverPurple.png b/sprites/holdCovers/holdCoverPurple.png new file mode 100644 index 0000000..5ef10f2 Binary files /dev/null and b/sprites/holdCovers/holdCoverPurple.png differ diff --git a/sprites/holdCovers/holdCoverPurple.xml b/sprites/holdCovers/holdCoverPurple.xml new file mode 100644 index 0000000..8b3c9ef --- /dev/null +++ b/sprites/holdCovers/holdCoverPurple.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sprites/holdCovers/holdCoverRed.png b/sprites/holdCovers/holdCoverRed.png new file mode 100644 index 0000000..164e47f Binary files /dev/null and b/sprites/holdCovers/holdCoverRed.png differ diff --git a/sprites/holdCovers/holdCoverRed.xml b/sprites/holdCovers/holdCoverRed.xml new file mode 100644 index 0000000..821e054 --- /dev/null +++ b/sprites/holdCovers/holdCoverRed.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/states/playstate.lua b/states/playstate.lua index 3d38275..cf171c9 100644 --- a/states/playstate.lua +++ b/states/playstate.lua @@ -59,6 +59,12 @@ local colors = { "green", "red" } +local covers = { + "Purple", + "Blue", + "Green", + "Red" +} local function state(songName, songDifficulty, show) ---@type engine.state @@ -171,6 +177,8 @@ local function state(songName, songDifficulty, show) local receptors = {} local opponentReceptors = {} + local holdCovers = {} + local opponentHoldCovers = {} local splashes = {} local keyBinds = {} -- loaded from settings.json, if anything's wrong then try rebinding in the menu @@ -635,7 +643,7 @@ local function state(songName, songDifficulty, show) hold.sprite.position = Vector2(receptors[hold.direction].position.x + hold.offset.x, settings.Downscroll and receptors[hold.direction].position.y - (hold.position - elapsed) * speed or receptors[hold.direction].position.y + (hold.position - elapsed) * speed) - if (hold.position - elapsed) * speed < 10 then + if (hold.position - elapsed) * speed < 0 then if love.keyboard.isDown(keyBinds[hold.direction]) then if characters.bf.animInfo["sing" .. directions[hold.direction] .. "-alt"] then characters.bf:PlayAnimation("sing" .. directions[hold.direction] .. "-alt") @@ -648,6 +656,11 @@ local function state(songName, songDifficulty, show) receptors[hold.direction]:PlayAnimation( string.format("%s confirm", string.lower(directions[hold.direction])), 24, false) receptorAnims[hold.direction] = "confirm" + if holdCovers[hold.direction].frame > 2 or not holdCovers[hold.direction].animation or holdCovers[hold.direction].alpha == 0 then + holdCovers[hold.direction]:PlayAnimation(string.format("holdCover%s", covers[hold.direction]), 24, false) + end + holdCovers[hold.direction].alpha = 1 + holdCovers[hold.direction].ende = false elseif (hold.position - elapsed) * speed < -150 then hold:Destroy() characters.bf:PlayAnimation("sing" .. directions[hold.direction] .. "miss") @@ -745,6 +758,17 @@ local function state(songName, songDifficulty, show) end receptor.extraOffset = receptorOffsets[receptorAnims[index]] end + + for index, holdCover in next, holdCovers do + if holdCover.ended then + if holdCover.ende then + holdCover.alpha = 0 + else + holdCover:PlayAnimation(string.format("holdCoverEnd%s", covers[index]), 24, false) + holdCover.ende = true + end + end + end if health <= 0 then die() @@ -945,6 +969,16 @@ local function state(songName, songDifficulty, show) splash.ui = true splashes[i + 1] = splash + + local noteCover = Sprite(string.format("sprites/holdCovers/holdCover%s.png", covers[i + 1]), string.format("sprites/holdCovers/holdCover%s.xml", covers[i + 1])) + + noteCover.layer = 12 + + noteCover.position = Vector2(1120 + (158 * i), settings.Downscroll and 780 or -100) + noteCover.ui = true + noteCover.starterFrame = 1 + + holdCovers[i + 1] = noteCover end for i = 0, 3 do -- opponent receptors, purely graphics