Proper rating system, notesplashes

This commit is contained in:
Entarno54 2025-06-03 23:04:13 +07:00
parent bb04425fb8
commit 7ecddedc54
7 changed files with 520 additions and 18 deletions

View File

@ -94,4 +94,14 @@ function conductor:mapBpmChanges(song)
print("Mapped the song BPM changes.")
end
function conductor:judgeNote(arr, diff)
for index, data in next, arr do
if diff <= data.hitWindow then
return data
end
end
return arr[#arr]
end
return conductor

View File

@ -59,10 +59,27 @@ local function state(songName, songDifficulty)
miss = 0,
}
local hitWindows = {
[135] = "bad",
[90] = "good",
[45] = "sick"
local rankWindows = {
{
rating = "sick",
hitWindow = 15,
spawnSplash = true
},
{
rating = "good",
hitWindow = 30,
spawnSplash = false
},
{
rating = "bad",
hitWindow = 50,
spawnSplash = false
},
{
rating = "shit",
hitWindow = 120,
spawnSplash = false
}
}
local directions = {
@ -71,6 +88,12 @@ local function state(songName, songDifficulty)
"UP",
"RIGHT"
}
local colors = {
"purple",
"blue",
"green",
"red"
}
local singVectors = {
singLEFT = myTypes.Vector2(20, 0),
@ -94,10 +117,10 @@ local function state(songName, songDifficulty)
}
local font = love.graphics.newFont("fonts/Phantomuff.ttf", 15)
local fps = 60 -- for the counter
local biggerFont = love.graphics.newFont("fonts/Phantomuff.ttf", 23)
local receptors = {}
local splashes = {}
local keyBinds = {} -- loaded from settings.json, if anything's wrong then check your settings.json
@ -128,7 +151,7 @@ local function state(songName, songDifficulty)
local closestNote
local closestIndex
for index, note in next, notes do
if note.position - conductor.songPosition < 200 then
if note.position - conductor.songPosition < 230 then
if note.mustPress and not note.pressed and note.direction == dir and (not closestNote or closestNote and note.position < closestNote.position) then
closestNote = note
closestIndex = index
@ -136,13 +159,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
local rating = conductor:judgeNote(rankWindows, math.abs(closestNote.position - elapsed))
if rating.spawnSplash then
splashes[closestNote.direction]:PlayAnimation(string.format("note splash %s %s", colors[closestNote.direction], math.random(1, 2)), 24, false)
end
ratings[rating] = ratings[rating] + 1
ratings[rating.rating] = ratings[rating.rating] + 1
characters.bf:PlayAnimation("sing"..directions[closestNote.direction])
closestNote.pressed = true
notes[closestIndex] = nil
@ -280,8 +303,6 @@ local function state(songName, songDifficulty)
zoom = myMath.lerp(zoom, 1, .05)
fps = 1000 / dt
if inst and inst:getVolume() ~= volume / 100 then
inst:setVolume(volume / 100)
voices:setVolume(volume / 100)
@ -291,6 +312,12 @@ local function state(songName, songDifficulty)
quit()
end
for index, splash in next, splashes do
if splash.animation and splash.ended then
splash:StopAnimation()
end
end
::continue::
end
@ -312,7 +339,7 @@ local function state(songName, songDifficulty)
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)
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)}, biggerFont, 0, 100)
end
love.window.setMode(1280, 720, { fullscreen = false , resizable = false})
@ -377,6 +404,14 @@ local function state(songName, songDifficulty)
receptor.ui = true -- So it doesnt move with the camera.
receptors[i + 1] = receptor
local splash = myTypes.Sprite("sprites/noteSplashes.png", "sprites/noteSplashes.json")
splash.position = myTypes.Vector2(550 + (79* i), settings.Downscroll and 0 or 380)
splash.ui = true
splashes[i + 1] = splash
end
for i = 0, 3 do -- opponent receptors, purely graphics

View File

@ -322,6 +322,11 @@ function Sprite:Frame(name, frame)
self.frame = frame
end
function Sprite:StopAnimation()
self.animation = nil
self.frame = 0
end
noteclass.types = module
module.note = noteclass.note

View File

@ -11,11 +11,11 @@ function CharacterClass:PlayAnimation(name)
local animName = self.animations[name]
local reOffset = self.flipX and -1 or 1
if self.animInfo[name].random then
self.sprite.extraOffset = module.myTypes.Vector2(self.animInfo[name].offsets[1] - self.stagePosition.x, self.animInfo[name].offsets[2] - self.stagePosition.y)
self.sprite:PlayAnimation(animName..string.format("%s ", math.random(self.animInfo[name].random[1], self.animInfo[name].random[2])), self.animInfo[name].fps)
self.sprite.extraOffset = module.myTypes.Vector2(self.animInfo[name].offsets[1] - self.stagePosition.x, self.animInfo[name].offsets[2] - self.stagePosition.y)
else
self.sprite:PlayAnimation(animName, self.animInfo[name].fps)
self.sprite.extraOffset = module.myTypes.Vector2(self.animInfo[name].offsets[1] - self.stagePosition.x, self.animInfo[name].offsets[2] - self.stagePosition.y)
self.sprite:PlayAnimation(animName, self.animInfo[name].fps)
end
self.singing = name ~= "idle" and name ~= "danceLeft" and name ~= "danceRight"
self.animation = name
@ -56,6 +56,7 @@ function module.character(name)
end
if newCharacter.animInfo["idle"] then
newCharacter.sprite.extraOffset = module.myTypes.Vector2(newCharacter.animInfo[name].offsets[1] - newCharacter.stagePosition.x, newCharacter.animInfo[name].offsets[2] - newCharacter.stagePosition.y)
newCharacter:PlayAnimation("idle")
else
newCharacter:PlayAnimation("danceLeft")

447
sprites/noteSplashes.json Normal file
View File

@ -0,0 +1,447 @@
{
"TextureAtlas": {
"SubTexture": [
{
"_name": "note splash purple 10000",
"_x": "0",
"_y": "0",
"_width": "210",
"_height": "210",
"_frameX": "-65",
"_frameY": "-70",
"_frameWidth": "210",
"_frameHeight": "210"
},
{
"_name": "note splash purple 10001",
"_x": "0",
"_y": "210",
"_width": "210",
"_height": "210",
"_frameX": "-65",
"_frameY": "-70",
"_frameWidth": "210",
"_frameHeight": "210"
},
{
"_name": "note splash purple 10002",
"_x": "0",
"_y": "420",
"_width": "210",
"_height": "210",
"_frameX": "-65",
"_frameY": "-70",
"_frameWidth": "210",
"_frameHeight": "210"
},
{
"_name": "note splash purple 10003",
"_x": "0",
"_y": "630",
"_width": "210",
"_height": "210",
"_frameX": "-65",
"_frameY": "-70",
"_frameWidth": "210",
"_frameHeight": "210"
},
{
"_name": "note splash purple 10004",
"_x": "0",
"_y": "840",
"_width": "210",
"_height": "210",
"_frameX": "-65",
"_frameY": "-70",
"_frameWidth": "210",
"_frameHeight": "210"
},
{
"_name": "note splash purple 20000",
"_x": "210",
"_y": "0",
"_width": "210",
"_height": "210",
"_frameX": "-65",
"_frameY": "-70",
"_frameWidth": "210",
"_frameHeight": "210"
},
{
"_name": "note splash purple 20001",
"_x": "210",
"_y": "210",
"_width": "210",
"_height": "210",
"_frameX": "-65",
"_frameY": "-70",
"_frameWidth": "210",
"_frameHeight": "210"
},
{
"_name": "note splash purple 20002",
"_x": "210",
"_y": "420",
"_width": "210",
"_height": "210",
"_frameX": "-65",
"_frameY": "-70",
"_frameWidth": "210",
"_frameHeight": "210"
},
{
"_name": "note splash purple 20003",
"_x": "210",
"_y": "630",
"_width": "210",
"_height": "210",
"_frameX": "-65",
"_frameY": "-70",
"_frameWidth": "210",
"_frameHeight": "210"
},
{
"_name": "note splash purple 20004",
"_x": "210",
"_y": "840",
"_width": "210",
"_height": "210",
"_frameX": "-65",
"_frameY": "-70",
"_frameWidth": "210",
"_frameHeight": "210"
},
{
"_name": "note splash blue 10000",
"_x": "420",
"_y": "0",
"_width": "210",
"_height": "210",
"_frameX": "-65",
"_frameY": "-70",
"_frameWidth": "210",
"_frameHeight": "210"
},
{
"_name": "note splash blue 10001",
"_x": "420",
"_y": "210",
"_width": "210",
"_height": "210",
"_frameX": "-65",
"_frameY": "-70",
"_frameWidth": "210",
"_frameHeight": "210"
},
{
"_name": "note splash blue 10002",
"_x": "420",
"_y": "420",
"_width": "210",
"_height": "210",
"_frameX": "-65",
"_frameY": "-70",
"_frameWidth": "210",
"_frameHeight": "210"
},
{
"_name": "note splash blue 10003",
"_x": "420",
"_y": "630",
"_width": "210",
"_height": "210",
"_frameX": "-65",
"_frameY": "-70",
"_frameWidth": "210",
"_frameHeight": "210"
},
{
"_name": "note splash blue 10004",
"_x": "420",
"_y": "840",
"_width": "210",
"_height": "210",
"_frameX": "-65",
"_frameY": "-70",
"_frameWidth": "210",
"_frameHeight": "210"
},
{
"_name": "note splash blue 20000",
"_x": "630",
"_y": "0",
"_width": "210",
"_height": "210",
"_frameX": "-65",
"_frameY": "-70",
"_frameWidth": "210",
"_frameHeight": "210"
},
{
"_name": "note splash blue 20001",
"_x": "630",
"_y": "210",
"_width": "210",
"_height": "210",
"_frameX": "-65",
"_frameY": "-70",
"_frameWidth": "210",
"_frameHeight": "210"
},
{
"_name": "note splash blue 20002",
"_x": "630",
"_y": "420",
"_width": "210",
"_height": "210",
"_frameX": "-65",
"_frameY": "-70",
"_frameWidth": "210",
"_frameHeight": "210"
},
{
"_name": "note splash blue 20003",
"_x": "630",
"_y": "630",
"_width": "210",
"_height": "210",
"_frameX": "-65",
"_frameY": "-70",
"_frameWidth": "210",
"_frameHeight": "210"
},
{
"_name": "note splash blue 20004",
"_x": "630",
"_y": "840",
"_width": "210",
"_height": "210",
"_frameX": "-65",
"_frameY": "-70",
"_frameWidth": "210",
"_frameHeight": "210"
},
{
"_name": "note splash green 10000",
"_x": "840",
"_y": "0",
"_width": "210",
"_height": "210",
"_frameX": "-65",
"_frameY": "-70",
"_frameWidth": "210",
"_frameHeight": "210"
},
{
"_name": "note splash green 10001",
"_x": "840",
"_y": "210",
"_width": "210",
"_height": "210",
"_frameX": "-65",
"_frameY": "-70",
"_frameWidth": "210",
"_frameHeight": "210"
},
{
"_name": "note splash green 10002",
"_x": "840",
"_y": "420",
"_width": "210",
"_height": "210",
"_frameX": "-65",
"_frameY": "-70",
"_frameWidth": "210",
"_frameHeight": "210"
},
{
"_name": "note splash green 10003",
"_x": "840",
"_y": "630",
"_width": "210",
"_height": "210",
"_frameX": "-65",
"_frameY": "-70",
"_frameWidth": "210",
"_frameHeight": "210"
},
{
"_name": "note splash green 10004",
"_x": "840",
"_y": "840",
"_width": "210",
"_height": "210",
"_frameX": "-65",
"_frameY": "-70",
"_frameWidth": "210",
"_frameHeight": "210"
},
{
"_name": "note splash green 20000",
"_x": "1050",
"_y": "0",
"_width": "210",
"_height": "210",
"_frameX": "-65",
"_frameY": "-70",
"_frameWidth": "210",
"_frameHeight": "210"
},
{
"_name": "note splash green 20001",
"_x": "1050",
"_y": "210",
"_width": "210",
"_height": "210",
"_frameX": "-65",
"_frameY": "-70",
"_frameWidth": "210",
"_frameHeight": "210"
},
{
"_name": "note splash green 20002",
"_x": "1050",
"_y": "420",
"_width": "210",
"_height": "210",
"_frameX": "-65",
"_frameY": "-70",
"_frameWidth": "210",
"_frameHeight": "210"
},
{
"_name": "note splash green 20003",
"_x": "1050",
"_y": "630",
"_width": "210",
"_height": "210",
"_frameX": "-65",
"_frameY": "-70",
"_frameWidth": "210",
"_frameHeight": "210"
},
{
"_name": "note splash green 20004",
"_x": "1050",
"_y": "840",
"_width": "210",
"_height": "210",
"_frameX": "-65",
"_frameY": "-70",
"_frameWidth": "210",
"_frameHeight": "210"
},
{
"_name": "note splash red 10000",
"_x": "1260",
"_y": "0",
"_width": "210",
"_height": "210",
"_frameX": "-65",
"_frameY": "-70",
"_frameWidth": "210",
"_frameHeight": "210"
},
{
"_name": "note splash red 10001",
"_x": "1260",
"_y": "210",
"_width": "210",
"_height": "210",
"_frameX": "-65",
"_frameY": "-70",
"_frameWidth": "210",
"_frameHeight": "210"
},
{
"_name": "note splash red 10002",
"_x": "1260",
"_y": "420",
"_width": "210",
"_height": "210",
"_frameX": "-65",
"_frameY": "-70",
"_frameWidth": "210",
"_frameHeight": "210"
},
{
"_name": "note splash red 10003",
"_x": "1260",
"_y": "630",
"_width": "210",
"_height": "210",
"_frameX": "-65",
"_frameY": "-70",
"_frameWidth": "210",
"_frameHeight": "210"
},
{
"_name": "note splash red 10004",
"_x": "1260",
"_y": "840",
"_width": "210",
"_height": "210",
"_frameX": "-65",
"_frameY": "-70",
"_frameWidth": "210",
"_frameHeight": "210"
},
{
"_name": "note splash red 20000",
"_x": "1470",
"_y": "0",
"_width": "210",
"_height": "210",
"_frameX": "-65",
"_frameY": "-70",
"_frameWidth": "210",
"_frameHeight": "210"
},
{
"_name": "note splash red 20001",
"_x": "1470",
"_y": "210",
"_width": "210",
"_height": "210",
"_frameX": "-65",
"_frameY": "-70",
"_frameWidth": "210",
"_frameHeight": "210"
},
{
"_name": "note splash red 20002",
"_x": "1470",
"_y": "420",
"_width": "210",
"_height": "210",
"_frameX": "-65",
"_frameY": "-70",
"_frameWidth": "210",
"_frameHeight": "210"
},
{
"_name": "note splash red 20003",
"_x": "1470",
"_y": "630",
"_width": "210",
"_height": "210",
"_frameX": "-65",
"_frameY": "-70",
"_frameWidth": "210",
"_frameHeight": "210"
},
{
"_name": "note splash red 20004",
"_x": "1470",
"_y": "840",
"_width": "210",
"_height": "210",
"_frameX": "-65",
"_frameY": "-70",
"_frameWidth": "210",
"_frameHeight": "210"
}
],
"_imagePath": "noteSplashes.png"
}
}

BIN
sprites/noteSplashes.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 153 KiB

View File

@ -2,8 +2,12 @@ local myTypes = require("modules.types")
local dancers = {}
local curSong
return {
onCreate = function(song)
curSong = song
dancers = {}
local sunset = myTypes.Image("images/limo/limoSunset.png", .2)