Skip to content

Commit

Permalink
add events
Browse files Browse the repository at this point in the history
  • Loading branch information
GuglioIsStupid committed Oct 9, 2023
1 parent 315b631 commit 52af3c2
Show file tree
Hide file tree
Showing 3 changed files with 169 additions and 18 deletions.
129 changes: 129 additions & 0 deletions src/love/data/ugh/events.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
{
"song": {
"speed": 2.3,
"stage": "tank",
"player1": "bf",
"player2": "tankman",
"player3": null,
"events": [
[
9375,
[
[
"Add Camera Zoom",
"",
""
]
]
],
[
9750,
[
[
"Add Camera Zoom",
"",
""
]
]
],
[
10125,
[
[
"Add Camera Zoom",
"",
""
]
]
],
[
10687.5,
[
[
"Add Camera Zoom",
"",
""
]
]
],
[
10875,
[
[
"Add Camera Zoom",
"",
""
]
]
],
[
11062.5,
[
[
"Add Camera Zoom",
"",
""
]
]
],
[
11250,
[
[
"Add Camera Zoom",
"0.03",
"0.06"
]
]
],
[
11437.5,
[
[
"Add Camera Zoom",
"0.03",
"0.06"
]
]
],
[
11625,
[
[
"Add Camera Zoom",
"0.06",
"0.12"
]
]
],
[
11812.5,
[
[
"Add Camera Zoom",
"0.06",
"0.12"
]
]
],
[
12000,
[
[
"Add Camera Zoom",
"",
""
]
]
]
],
"notes": [],
"splashSkin": null,
"validScore": false,
"gfVersion": "gf-tankmen",
"bpm": 160,
"arrowSkin": null,
"needsVoices": true,
"song": "Ugh"
}
}
41 changes: 35 additions & 6 deletions src/love/states/weeks.lua
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,23 @@ local noteCamTweens = {
end
}

local eventFuncs = {
["Add Camera Zoom"] = function(size, sizeHud)
local size = tonumber(size) or 0.015
local sizeHud = tonumber(sizeHud) or 0.03
camera.zoom = camera.zoom + (size or 0.015)
uiScale.zoom = uiScale.zoom + (sizeHud or 0.03)
end,
["Alter Camera Bop"] = function(_intensity, _interveral)
local _intensity, _interveral
_intensity = tonumber(_intensity) or 1
_interveral = tonumber(_interveral) or 4

camBopIntensity = _intensity
camBopInterval = _interveral
end,
}

local ratingTimers = {}

local useAltAnims
Expand Down Expand Up @@ -324,6 +341,7 @@ return {

initUI = function(self, option)
events = {}
songEvents = {}
enemyNotes = {}
boyfriendNotes = {}
gfNotes = {}
Expand All @@ -333,8 +351,6 @@ return {
ratingPercent = 0.0
noteCounter = 0

songEvents = {}

if not pixel then
sprites.leftArrow = love.filesystem.load("sprites/left-arrow.lua")
sprites.downArrow = love.filesystem.load("sprites/down-arrow.lua")
Expand Down Expand Up @@ -856,10 +872,10 @@ return {
charte = json.decode(love.filesystem.read(charte)).song
-- for all in charte.events, add it to songEvents
for i = 1, #charte.events do
local eventTime = charte.events[i][1]
local event = charte.events[i][2][1][1]
local eventArgs = charte.events[i][2][1][2]
local eventArgs2 = charte.events[i][2][1][3]
local eventTime = charte.events[i][1] or 0
local event = charte.events[i][2][1][1] or "Hey!"
local eventArgs = charte.events[i][2][1][2] or ""
local eventArgs2 = charte.events[i][2][1][3] or ""

table.insert(songEvents, {time = eventTime, event = event, n=event, args = eventArgs, args2 = eventArgs2})
end
Expand Down Expand Up @@ -1065,6 +1081,19 @@ return {
end
end

for i = 1, #songEvents do
if songEvents[i].time <= absMusicTime then
if eventFuncs[songEvents[i].event] then
eventFuncs[songEvents[i].event](songEvents[i].args, songEvents[i].args2)
else
print(songEvents[i].event .. " is not implemented!")
end

table.remove(songEvents, i)
break
end
end

if (beatHandler.onBeat() and beatHandler.getBeat() % camera.camBopInterval == 0 and camera.zooming and camera.zoom < 1.35 and not camera.locked) then
camera.zoom = camera.zoom + 0.015 * camera.camBopIntensity
uiScale.zoom = uiScale.zoom + 0.03 * camera.camBopIntensity
Expand Down
17 changes: 5 additions & 12 deletions src/love/weeks/week7.lua
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ return {
weeks:generateNotes("data/guns/guns" .. difficulty .. ".json")
else
weeks:generateNotes("data/ugh/ugh" .. difficulty .. ".json")
weeks:generateEvents("data/ugh/events.json")
end
end,

Expand All @@ -112,30 +113,22 @@ return {
if song == 1 then
if musicTime >= 5620 then
if musicTime <= 5720 then
if enemy:getAnimName() == "up" then
enemy:animate("ugh", false)
end
enemy:animate("ugh", false)
end
end
if musicTime >= 14620 then
if musicTime <= 14720 then
if enemy:getAnimName() == "up" then
enemy:animate("ugh", false)
end
enemy:animate("ugh", false)
end
end
if musicTime >= 49120 then
if musicTime <= 49220 then
if enemy:getAnimName() == "up" then
enemy:animate("ugh", false)
end
enemy:animate("ugh", false)
end
end
if musicTime >= 77620 then
if musicTime <= 77720 then
if enemy:getAnimName() == "up" then
enemy:animate("ugh", false)
end
enemy:animate("ugh", false)
end
end
end
Expand Down

0 comments on commit 52af3c2

Please sign in to comment.