This commit is contained in:
Entarno54 2025-06-01 19:40:37 +07:00
parent da89a077ca
commit ab160da64b
8 changed files with 75 additions and 24 deletions

View File

@ -194,7 +194,7 @@
209
],
"camera_position": [
-100,
-300,
40
],
"sing_duration": 4,

View File

@ -180,7 +180,7 @@
209
],
"camera_position": [
-100,
-500,
40
],
"sing_duration": 4,

View File

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

View File

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

View File

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

View File

@ -8,7 +8,10 @@
"stress": [
"hard"
],
"obituary": [
"milf": [
"hard"
],
"target-practice":[
"hard"
]
}

View File

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

View File

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