From ab160da64b37cffe64d6c9dc5311505faa9a423f Mon Sep 17 00:00:00 2001 From: Entarno54 Date: Sun, 1 Jun 2025 19:40:37 +0700 Subject: [PATCH] Evil --- characters/bf-car.json | 2 +- characters/bf.json | 2 +- main.lua | 4 +- modules/states/playstate.lua | 71 ++++++++++++++++++++++++++++++------ modules/types.lua | 5 +-- songs.json | 5 ++- sprites/NOTE_assets.json | 4 +- stages/stage.json | 6 +-- 8 files changed, 75 insertions(+), 24 deletions(-) diff --git a/characters/bf-car.json b/characters/bf-car.json index 962a88d..662514e 100644 --- a/characters/bf-car.json +++ b/characters/bf-car.json @@ -194,7 +194,7 @@ 209 ], "camera_position": [ - -100, + -300, 40 ], "sing_duration": 4, diff --git a/characters/bf.json b/characters/bf.json index a69cfda..ae6218d 100644 --- a/characters/bf.json +++ b/characters/bf.json @@ -180,7 +180,7 @@ 209 ], "camera_position": [ - -100, + -500, 40 ], "sing_duration": 4, diff --git a/main.lua b/main.lua index 4486395..59bb2b8 100644 --- a/main.lua +++ b/main.lua @@ -17,6 +17,8 @@ local stateLoaded = false local pressed = {false,false,false} +local font = love.graphics.newFont("fonts/Phantomuff.ttf", 25) + -- for index, song in next, songs do -- curSong = index -- curDiff = song[1] @@ -73,7 +75,7 @@ function love.draw() curState.draw() else myTypes.drawSprites() - love.graphics.print(string.format("Song: %s, Difficulty: %s, List: %s", curSong, curDiff, logging.dump(curDiffList)), love.graphics.newFont(15, "light"), love.graphics:getWidth()/2, love.graphics:getHeight()/2 + 150, 0, 1, 1, 200) + love.graphics.print(string.format("Song: %s, Difficulty: %s, List: %s", curSong, curDiff, logging.dump(curDiffList)), font, love.graphics:getWidth()/2 - 20, love.graphics:getHeight()/2 + 150, 0, 1, 1, 200) end end diff --git a/modules/states/playstate.lua b/modules/states/playstate.lua index a1a9f85..8cf56a5 100644 --- a/modules/states/playstate.lua +++ b/modules/states/playstate.lua @@ -34,6 +34,8 @@ local function state(songName, songDifficulty) local zoom = 1 + local volume = 100 + local playing = false local stage = json.parse(files.read_file("stages/stage.json")) @@ -45,6 +47,20 @@ local function state(songName, songDifficulty) local settings = {} + local ratings = { + sick = 0, + good = 0, + bad = 0, + shit = 0, + miss = 0, + } + + local hitWindows = { + [135] = "bad", + [90] = "good", + [45] = "sick" + } + local directions = { "LEFT", "DOWN", @@ -73,6 +89,8 @@ local function state(songName, songDifficulty) false } + local font = love.graphics.newFont("fonts/Phantomuff.ttf", 15) + local fps = 60 -- for the counter local receptors = {} @@ -80,6 +98,7 @@ local function state(songName, songDifficulty) local keyBinds = {} -- loaded from settings.json, if anything's wrong then check your settings.json local paused = false + local elapsed = 0 local pauseTime = 0 -- the global amount of time the song has been paused local pauseStart = 0 -- the start of the latest pause (for pauseTime calculation) @@ -113,6 +132,13 @@ local function state(songName, songDifficulty) end end if closestNote then + local rating = "shit" + for window, rate in next, hitWindows do + if math.abs(closestNote.position - elapsed) <= window then + rating = rate + end + end + ratings[rating] = ratings[rating] + 1 characters.bf:PlayAnimation("sing"..directions[closestNote.direction]) closestNote.pressed = true receptors[dir]:PlayAnimation(string.lower(directions[dir]).." confirm", 5, false) @@ -121,9 +147,6 @@ local function state(songName, songDifficulty) end end - local elapsed = 0 - local actualElapsed = 0 - function state.update(dt) if not playing then return end -- playing isn't supposed to work like "paused", it's there to keep the game from working during loading @@ -186,29 +209,33 @@ local function state(songName, songDifficulty) unspawnedNotes[index] = nil notes[#notes+1] = note elseif note.position - elapsed < 600 and not note.mustPress then + note:spawn() unspawnedNotes[index] = nil notes[#notes+1] = note end end for index, note in next, notes do - if note.spawned then - note.sprite.position = myTypes.Vector2(400 + 65 * (note.direction - 1), settings.Downscroll and 430 - (note.position-elapsed) or note.position - elapsed) + if note.mustPress then + note.sprite.position = myTypes.Vector2(600 + (79 * (note.direction - 1)), settings.Downscroll and 430 - (note.position-elapsed) or note.position - elapsed) if note.position - elapsed < -150 then note:destroy() miss:stop() miss:play() characters.bf:PlayAnimation("sing"..directions[note.direction].."miss") notes[index] = nil + ratings.miss = ratings.miss + 1 end else - if note.position - elapsed < 50 then + note.sprite.position = myTypes.Vector2(20 + 79 * (note.direction - 1), settings.Downscroll and 430 - (note.position-elapsed) or note.position - elapsed) + if note.position - elapsed < 10 then notes[index] = nil if section.altAnim or note.altAnim then characters.dad:PlayAnimation("sing"..directions[note.direction].."-alt") else characters.dad:PlayAnimation("sing"..directions[note.direction]) end + note:destroy() note = nil end end @@ -228,6 +255,11 @@ local function state(songName, songDifficulty) fps = 1000 / dt + if inst:getVolume() ~= volume / 100 then + inst:setVolume(volume / 100) + voices:setVolume(volume / 100) + end + ::continue:: end @@ -245,18 +277,20 @@ local function state(songName, songDifficulty) love.graphics.setCanvas() - love.graphics.draw(mainCanvas, (love.graphics:getHeight() * (4/3) - (love.graphics:getHeight()* (4/3)) * zoom) / 2, (love.graphics:getHeight()- love.graphics:getHeight() * zoom) / 2, 0, ((love.graphics:getHeight() / 1080) * (4/3)) * zoom, (love.graphics:getHeight() / 1080) * zoom) + love.graphics.draw(mainCanvas, (love.graphics.getWidth() - (love.graphics.getWidth() * zoom)) / 2, (love.graphics.getHeight() - love.graphics.getHeight() * zoom) / 2, 0, love.graphics.getWidth()/1920 * zoom, (love.graphics.getHeight()/1080 * zoom)) - love.graphics.print({{0,0,0,1}, string.format("FPS: %s", love.timer.getFPS())}) + love.graphics.print({{0,0,0,1}, string.format("FPS: %s \nVolume: %s", love.timer.getFPS(), volume)}, font) + + love.graphics.print({{0,0,0,1}, string.format("Sick: %s \nGood: %s \nBad: %s \nShit: %s \nMiss: %s", ratings.sick, ratings.good, ratings.bad, ratings.shit, ratings.miss)}, font, 0, 20) end - love.window.setMode(1280, 720, { fullscreen = false , resizable = true}) + love.window.setMode(1280, 720, { fullscreen = false , resizable = false}) function state.load() -- GF first so she is below other chars if chart.gfVersion ~= "none" then - characters.gf = myTypes.character(chart.gfVersion) - characters.gf.stagePosition = myTypes.Vector2(stage.girlfriend[1], stage.girlfriend[2]) + characters.gf = myTypes.character(chart.gfVersion) + characters.gf.stagePosition = myTypes.Vector2(stage.girlfriend[1], stage.girlfriend[2]) end characters.bf = myTypes.character(chart.player1) @@ -277,12 +311,21 @@ local function state(songName, songDifficulty) local receptor = myTypes.Sprite("sprites/NOTE_assets.png", "sprites/NOTE_assets.json") receptor:PlayAnimation("arrow"..directions[i+1], 25, false) - receptor.position = myTypes.Vector2(400 + (65 * i), settings.Downscroll and 0 or 430) + receptor.position = myTypes.Vector2(600 + (79* i), settings.Downscroll and 0 or 430) receptor.ui = true -- So it doesnt move with the camera. receptors[i + 1] = receptor end + + for i = 0, 3 do -- opponent receptors, purely graphics + local receptor = myTypes.Rect("sprites/NOTE_assets.png", "sprites/NOTE_assets.json") + receptor:Frame("arrow"..directions[i+1], 0) + + receptor.position = myTypes.Vector2(20 + 79 * i, settings.Downscroll and 0 or 430) + + receptor.ui = true -- So it doesnt move with the camera. + end myTypes.cameraTarget = myTypes.Vector2() @@ -335,6 +378,10 @@ local function state(songName, songDifficulty) checkNote(3) elseif key == keyBinds[4] then checkNote(4) + elseif key == "-" then + volume = volume ~= 0 and volume - 10 or 0 + elseif key == "+" or key == "=" then + volume = volume ~= 100 and volume + 10 or 100 end end diff --git a/modules/types.lua b/modules/types.lua index 1ad9efd..1f4647d 100644 --- a/modules/types.lua +++ b/modules/types.lua @@ -84,7 +84,7 @@ function module.Sprite(image, sheet) quads[name:sub(0, name:len() - 4)] = {} end - quads[name:sub(0, name:len() - 4)][num] = {quad = love.graphics.newQuad(x, y, width, height, newSprite.image), offset = module.Vector2(frameX or 0, frameY or 0), resize = module.Vector2(.8,1)} + quads[name:sub(0, name:len() - 4)][num] = {quad = love.graphics.newQuad(x, y, width, height, newSprite.image), offset = module.Vector2(frameX or 0, frameY or 0), resize = module.Vector2(1,1)} end newSprite.quads = quads @@ -94,7 +94,6 @@ function module.Sprite(image, sheet) return newSprite else - local newSprite = setmetatable({ image = cachedQuads[sheet].image, quads = cachedQuads[sheet].quads, @@ -257,7 +256,7 @@ function module.Rect(image, sheet) quads[name:sub(0, name:len() - 4)] = {} end - quads[name:sub(0, name:len() - 4)][num] = {quad = love.graphics.newQuad(x, y, width, height, newSprite.image), offset = module.Vector2(frameX or 0, frameY or 0), resize = module.Vector2(.8,1)} + quads[name:sub(0, name:len() - 4)][num] = {quad = love.graphics.newQuad(x, y, width, height, newSprite.image), offset = module.Vector2(frameX or 0, frameY or 0), resize = module.Vector2(1,1)} end newSprite.quads = quads diff --git a/songs.json b/songs.json index 9d959e3..cc58f7f 100644 --- a/songs.json +++ b/songs.json @@ -8,7 +8,10 @@ "stress": [ "hard" ], - "obituary": [ + "milf": [ + "hard" + ], + "target-practice":[ "hard" ] } diff --git a/sprites/NOTE_assets.json b/sprites/NOTE_assets.json index 2c84d71..b338985 100644 --- a/sprites/NOTE_assets.json +++ b/sprites/NOTE_assets.json @@ -56,7 +56,7 @@ "_y": "0", "_width": "240", "_height": "236", - "_frameX": "-6", + "_frameX": "-12", "_frameY": "0", "_frameWidth": "240", "_frameHeight": "236" @@ -67,7 +67,7 @@ "_y": "0", "_width": "240", "_height": "236", - "_frameX": "-6", + "_frameX": "-12", "_frameY": "0", "_frameWidth": "240", "_frameHeight": "236" diff --git a/stages/stage.json b/stages/stage.json index e9a9e5c..85e32b9 100644 --- a/stages/stage.json +++ b/stages/stage.json @@ -3,9 +3,9 @@ "defaultZoom": 0.75, "isPixelStage": false, - "boyfriend": [500, 100], - "girlfriend": [0, 100], - "opponent": [100, 100], + "boyfriend": [700, 100], + "girlfriend": [50, 100], + "opponent": [0, 100], "hide_girlfriend": false, "camera_boyfriend": [0, 0],