Fixed spooky erect, added song offset setting

This commit is contained in:
entar 2025-07-08 22:12:05 +07:00
parent 8e1a77d038
commit 19cf937334
7 changed files with 33 additions and 9 deletions

View File

@ -127,7 +127,7 @@
"image": "sprites/characters/bf_dark",
"position": [
0,
350
700
],
"healthicon": "bf",
"flip_x": false,

View File

@ -101,7 +101,7 @@
"image": "sprites/characters/spooky_dark",
"position": [
0,
200
400
],
"healthicon": "spooky",
"flip_x": false,

View File

@ -4,7 +4,7 @@ return {
onCreate = function(song)
local trees = Sprite("sprites/spooky/erect/bgtrees.png", "sprites/spooky/erect/bgtrees.json")
trees:PlayAnimation("bgtrees", 5, true)
trees.position = Vector2(100, 0)
trees.position = Vector2(200, 0)
trees.modifier = 0.8
trees.layer = -2

View File

@ -8,7 +8,7 @@ return {
local crowd = Sprite("sprites/stage/erect/crowd.png", "sprites/stage/erect/crowd.json")
crowd:PlayAnimation("Symbol 2 instance 1", 24, true)
crowd.position = Vector2(560, 150)
crowd.position = Vector2(560, 300)
crowd.modifier = 0.8
crowd.layer = -9

View File

@ -8,7 +8,8 @@ local defaultSettings = { -- The way its in the JSON
"b",
"up",
"right"
}
},
Offset = 0
}
return function()
---@class StateClass
@ -43,6 +44,15 @@ return function()
os.execute("mkdir "..data)
files.write_file(data.."/Settings.json", json.stringify(defaultSettings))
print("Written")
else
settings = json.parse(settings)
--Incase the settings are old
for index, setting in next, defaultSettings do
if not settings[index] then
settings[index] = setting
end
end
files.write_file(data.."/Settings.json", json.stringify(settings))
end
if not freaky then

View File

@ -10,7 +10,8 @@ local settingList = { -- Path for the positions in JSON
Down = "Keybinds.2",
Up = "Keybinds.3",
Right = "Keybinds.4",
Downscroll = "Downscroll"
Downscroll = "Downscroll",
Offset = "Offset"
}
local categoryList = { -- The way its on the screen
@ -26,7 +27,8 @@ local categoryList = { -- The way its on the screen
{
name = "Gameplay",
settings = {
"Downscroll"
"Downscroll",
"Offset"
}
}
}
@ -97,6 +99,16 @@ return function()
files.write_file(data.."/Settings.json", json.stringify(settings))
state.changeState("menustate")
elseif key == "right" or key == "left" then
local listSetting = globalList[currentSetting]
if categories[listSetting] then return end
local settingPath, settingLast = getSettingPath(listSetting)
local setting = settingPath[settingLast]
if type(setting) == "number" then
settingPath[settingLast] = settingPath[settingLast] + (key == "right" and 1 or -1)
end
end
end

View File

@ -145,6 +145,7 @@ local function state(songName, songDifficulty, show)
local splashes = {}
local keyBinds = {} -- loaded from settings.json, if anything's wrong then try rebinding in the menu
local offset = 0
local paused = false
local elapsed = 0
@ -508,9 +509,9 @@ local function state(songName, songDifficulty, show)
end
inst:seek(elapsed / 1000 > 0 and elapsed / 1000 or 0, "seconds")
inst:seek((elapsed + offset) / 1000 > 0 and (elapsed + offset) / 1000 or 0, "seconds")
if chart.needsVoices then
voices:seek(elapsed / 1000 > 0 and elapsed / 1000 or 0, "seconds")
voices:seek((elapsed + offset) / 1000 > 0 and (elapsed + offset) / 1000 or 0, "seconds")
end
end
@ -989,6 +990,7 @@ local function state(songName, songDifficulty, show)
render.cameraTarget = Vector2()
keyBinds = settings.Keybinds
offset = settings.Offset
state.loaded = true