Events and more logging
This commit is contained in:
parent
7211415ab7
commit
22a798943d
@ -1,20 +1,97 @@
|
||||
{
|
||||
"animations": [
|
||||
{
|
||||
"offsets": [
|
||||
-5,
|
||||
0
|
||||
],
|
||||
"loop": false,
|
||||
"offsets": [
|
||||
-15,
|
||||
-54
|
||||
],
|
||||
"anim": "singDOWN",
|
||||
"fps": 24,
|
||||
"anim": "idle",
|
||||
"indices": [],
|
||||
"name": "BF idle dance"
|
||||
"name": "BF NOTE DOWN",
|
||||
"indices": []
|
||||
},
|
||||
{
|
||||
"loop": false,
|
||||
"offsets": [
|
||||
7,
|
||||
19
|
||||
],
|
||||
"anim": "singLEFTmiss",
|
||||
"fps": 24,
|
||||
"name": "BF NOTE LEFT MISS",
|
||||
"indices": []
|
||||
},
|
||||
{
|
||||
"loop": false,
|
||||
"offsets": [
|
||||
-15,
|
||||
-19
|
||||
],
|
||||
"anim": "singDOWNmiss",
|
||||
"fps": 24,
|
||||
"name": "BF NOTE DOWN MISS",
|
||||
"indices": []
|
||||
},
|
||||
{
|
||||
"loop": false,
|
||||
"offsets": [
|
||||
-46,
|
||||
27
|
||||
],
|
||||
"anim": "singUPmiss",
|
||||
"fps": 24,
|
||||
"name": "BF NOTE UP MISS",
|
||||
"indices": []
|
||||
},
|
||||
{
|
||||
"loop": false,
|
||||
"offsets": [
|
||||
-44,
|
||||
22
|
||||
],
|
||||
"anim": "singRIGHTmiss",
|
||||
"fps": 24,
|
||||
"name": "BF NOTE RIGHT MISS",
|
||||
"indices": []
|
||||
},
|
||||
{
|
||||
"loop": false,
|
||||
"offsets": [
|
||||
11,
|
||||
10
|
||||
],
|
||||
"anim": "firstDeath",
|
||||
"fps": 24,
|
||||
"name": "BF dies",
|
||||
"indices": []
|
||||
},
|
||||
{
|
||||
"loop": true,
|
||||
"offsets": [
|
||||
11,
|
||||
4
|
||||
],
|
||||
"anim": "deathLoop",
|
||||
"fps": 24,
|
||||
"name": "BF Dead Loop",
|
||||
"indices": []
|
||||
},
|
||||
{
|
||||
"loop": false,
|
||||
"offsets": [
|
||||
11,
|
||||
68
|
||||
],
|
||||
"anim": "deathConfirm",
|
||||
"fps": 24,
|
||||
"name": "BF Dead confirm",
|
||||
"indices": []
|
||||
},
|
||||
{
|
||||
"offsets": [
|
||||
46,
|
||||
1
|
||||
7,
|
||||
-8
|
||||
],
|
||||
"loop": false,
|
||||
"fps": 24,
|
||||
@ -24,30 +101,8 @@
|
||||
},
|
||||
{
|
||||
"offsets": [
|
||||
-31,
|
||||
-40
|
||||
],
|
||||
"loop": false,
|
||||
"fps": 24,
|
||||
"anim": "singDOWN",
|
||||
"indices": [],
|
||||
"name": "BF NOTE DOWN"
|
||||
},
|
||||
{
|
||||
"offsets": [
|
||||
-68,
|
||||
57
|
||||
],
|
||||
"loop": false,
|
||||
"fps": 24,
|
||||
"anim": "singUP",
|
||||
"indices": [],
|
||||
"name": "BF NOTE UP"
|
||||
},
|
||||
{
|
||||
"offsets": [
|
||||
-67,
|
||||
3
|
||||
-50,
|
||||
-6
|
||||
],
|
||||
"loop": false,
|
||||
"fps": 24,
|
||||
@ -56,151 +111,63 @@
|
||||
"name": "BF NOTE RIGHT"
|
||||
},
|
||||
{
|
||||
"offsets": [
|
||||
41,
|
||||
23
|
||||
],
|
||||
"loop": false,
|
||||
"offsets": [
|
||||
-43,
|
||||
28
|
||||
],
|
||||
"anim": "singUP",
|
||||
"fps": 24,
|
||||
"anim": "singLEFTmiss",
|
||||
"indices": [],
|
||||
"name": "BF NOTE LEFT MISS"
|
||||
"name": "BF NOTE UP",
|
||||
"indices": []
|
||||
},
|
||||
{
|
||||
"offsets": [
|
||||
-26,
|
||||
-8
|
||||
],
|
||||
"loop": false,
|
||||
"fps": 24,
|
||||
"anim": "singDOWNmiss",
|
||||
"indices": [],
|
||||
"name": "BF NOTE DOWN MISS"
|
||||
},
|
||||
{
|
||||
"offsets": [
|
||||
-55,
|
||||
52
|
||||
-2,
|
||||
6
|
||||
],
|
||||
"loop": false,
|
||||
"fps": 24,
|
||||
"anim": "singUPmiss",
|
||||
"indices": [],
|
||||
"name": "BF NOTE UP MISS"
|
||||
},
|
||||
{
|
||||
"offsets": [
|
||||
-61,
|
||||
29
|
||||
],
|
||||
"loop": false,
|
||||
"fps": 24,
|
||||
"anim": "singRIGHTmiss",
|
||||
"indices": [],
|
||||
"name": "BF NOTE RIGHT MISS"
|
||||
},
|
||||
{
|
||||
"offsets": [
|
||||
-12,
|
||||
25
|
||||
],
|
||||
"loop": false,
|
||||
"fps": 24,
|
||||
"anim": "hey",
|
||||
"indices": [],
|
||||
"name": "BF HEY"
|
||||
},
|
||||
{
|
||||
"offsets": [
|
||||
-6,
|
||||
26
|
||||
],
|
||||
"loop": false,
|
||||
"fps": 24,
|
||||
"anim": "hurt",
|
||||
"indices": [],
|
||||
"name": "BF hit"
|
||||
"name": "BF HEY!!",
|
||||
"indices": []
|
||||
},
|
||||
{
|
||||
"offsets": [
|
||||
-26,
|
||||
5
|
||||
],
|
||||
"loop": false,
|
||||
"fps": 24,
|
||||
"anim": "scared",
|
||||
"indices": [],
|
||||
"name": "BF idle shaking"
|
||||
},
|
||||
{
|
||||
"offsets": [
|
||||
-3,
|
||||
11
|
||||
],
|
||||
"loop": false,
|
||||
"fps": 24,
|
||||
"anim": "firstDeath",
|
||||
"indices": [],
|
||||
"name": "BF dies"
|
||||
},
|
||||
{
|
||||
"offsets": [
|
||||
-3,
|
||||
5
|
||||
],
|
||||
"loop": true,
|
||||
"offsets": [
|
||||
-5,
|
||||
1
|
||||
],
|
||||
"anim": "scared",
|
||||
"fps": 24,
|
||||
"anim": "deathLoop",
|
||||
"indices": [],
|
||||
"name": "BF Dead Loop"
|
||||
"name": "BF idle shaking",
|
||||
"indices": []
|
||||
},
|
||||
{
|
||||
"loop": false,
|
||||
"offsets": [
|
||||
-5,
|
||||
0
|
||||
],
|
||||
"anim": "idle",
|
||||
"fps": 24,
|
||||
"name": "BF idle dance",
|
||||
"indices": []
|
||||
},
|
||||
{
|
||||
"offsets": [
|
||||
-3,
|
||||
69
|
||||
-4,
|
||||
7
|
||||
],
|
||||
"loop": false,
|
||||
"fps": 24,
|
||||
"anim": "deathConfirm",
|
||||
"anim": "Laugh",
|
||||
"indices": [],
|
||||
"name": "BF Dead confirm"
|
||||
},
|
||||
{
|
||||
"offsets": [
|
||||
508,
|
||||
250
|
||||
],
|
||||
"loop": false,
|
||||
"fps": 24,
|
||||
"anim": "attack",
|
||||
"indices": [],
|
||||
"name": "boyfriend attack"
|
||||
},
|
||||
{
|
||||
"offsets": [
|
||||
-50,
|
||||
-33
|
||||
],
|
||||
"loop": false,
|
||||
"fps": 24,
|
||||
"anim": "pre-attack",
|
||||
"indices": [],
|
||||
"name": "bf pre attack"
|
||||
},
|
||||
{
|
||||
"offsets": [
|
||||
-14,
|
||||
20
|
||||
],
|
||||
"indices": [],
|
||||
"fps": 24,
|
||||
"anim": "dodge",
|
||||
"loop": false,
|
||||
"name": "dodge UP"
|
||||
"name": "BF Laugh"
|
||||
}
|
||||
],
|
||||
"no_antialiasing": false,
|
||||
"image": "sprites/characters/BF_ZERO_INDIE_CROSS_OG",
|
||||
"image": "sprites/characters/BOYFRIEND",
|
||||
"position": [
|
||||
0,
|
||||
350
|
||||
@ -214,7 +181,7 @@
|
||||
],
|
||||
"camera_position": [
|
||||
-400,
|
||||
60
|
||||
90
|
||||
],
|
||||
"sing_duration": 4,
|
||||
"scale": 1
|
||||
|
1
log.log
Normal file
1
log.log
Normal file
@ -0,0 +1 @@
|
||||
Is chart fileIs chart fileIs chart fileEvents are noteshey!hey!hey!hey!hey!hey!hey!hey!hey!hey!hey!hey!hey!hey!hey!hey!Is chart fileEvents are noteshey!hey!hey!hey!hey!hey!hey!hey!hey!hey!hey!hey!hey!hey!hey!hey!Is chart fileEvents are noteshey!hey!hey!hey!hey!hey!hey!hey!hey!hey!hey!hey!hey!hey!hey!hey!Is chart fileEvents are noteshey!hey!hey!hey!hey!hey!hey!hey!hey!hey!hey!hey!hey!hey!hey!hey!Is chart fileEvents are noteshey!hey!hey!hey!hey!hey!hey!hey!hey!hey!hey!hey!hey!hey!hey!hey!Is chart fileIs chart fileIs chart fileIs chart fileIs chart file
|
@ -13,4 +13,11 @@ function logging.dump(o)
|
||||
end
|
||||
end
|
||||
|
||||
function logging.log(t)
|
||||
local log = io.open("log.log", "a")
|
||||
log:write(string.format("\n%s", t))
|
||||
log:flush()
|
||||
log:close()
|
||||
end
|
||||
|
||||
return logging
|
@ -8,6 +8,7 @@ local function state(songName, songDifficulty)
|
||||
local json = require("modules.json")
|
||||
local files = require("modules.files")
|
||||
local socket = require("socket")
|
||||
local logging = require("modules.logging")
|
||||
-- I NEED THEM IMPORTS
|
||||
|
||||
local startTime = 0
|
||||
@ -336,11 +337,14 @@ local function state(songName, songDifficulty)
|
||||
if characters.dad then
|
||||
local currentSingVector = singVectors[characters.dad.animation] or myTypes.Vector2()
|
||||
myTypes.render.cameraTarget = myTypes.Vector2(stage.camera_opponent[1], stage.camera_opponent[2]):Add(characters.dad.stageCamera:Negate()):Add(myTypes.Vector2(0, -200)):Add(currentSingVector)
|
||||
else
|
||||
local currentSingVector = singVectors[characters.gf.animation] or myTypes.Vector2()
|
||||
myTypes.render.cameraTarget = myTypes.Vector2(stage.camera_girlfriend[1], stage.camera_girlfriend[2]):Add(characters.gf.stageCamera:Negate()):Add(myTypes.Vector2(0, -200)):Add(currentSingVector)
|
||||
end
|
||||
end
|
||||
else
|
||||
local currentSingVector = singVectors[characters.gf.animation] or myTypes.Vector2()
|
||||
myTypes.render.cameraTarget = myTypes.Vector2(stage.camera_girlfriend[1], stage.camera_ocamera_girlfriendponent[2]):Add(characters.gf.stageCamera:Negate()):Add(myTypes.Vector2(0, -200)):Add(currentSingVector)
|
||||
myTypes.render.cameraTarget = myTypes.Vector2(stage.camera_girlfriend[1], stage.camera_girlfriend[2]):Add(characters.gf.stageCamera:Negate()):Add(myTypes.Vector2(0, -200)):Add(currentSingVector)
|
||||
end
|
||||
end
|
||||
|
||||
@ -454,6 +458,12 @@ local function state(songName, songDifficulty)
|
||||
elseif event.name == "hey!" then
|
||||
characters.bf:PlayAnimation("hey")
|
||||
end
|
||||
|
||||
for index, module in next, modules do
|
||||
if module.onEvent then
|
||||
module.onEvent(event)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -645,8 +655,8 @@ local function state(songName, songDifficulty)
|
||||
local newEvent = {
|
||||
time = note[1],
|
||||
name = string.lower(note[3]),
|
||||
var1 = string.lower(note[4]),
|
||||
var2 = string.lower(note[5])
|
||||
var1 = string.lower(note[4]) or "",
|
||||
var2 = string.lower(note[5]) or ""
|
||||
}
|
||||
events[#events+1] = newEvent
|
||||
|
||||
@ -659,9 +669,13 @@ local function state(songName, songDifficulty)
|
||||
|
||||
local eventChartFile = files.read_file(string.format("charts/%s/events.json", songName))
|
||||
if eventChartFile then
|
||||
local eventChart = json.parse(eventChartFile)
|
||||
logging.log("Is chart file")
|
||||
|
||||
local eventChart = json.parse(eventChartFile).song
|
||||
if eventChart.song ~= chart.song then goto noChart end
|
||||
|
||||
if eventChart.notes then
|
||||
logging.log("Events are notes")
|
||||
for index, section in next, eventChart.notes do
|
||||
for index, note in next, section.sectionNotes do
|
||||
local newEvent = {
|
||||
@ -675,11 +689,14 @@ local function state(songName, songDifficulty)
|
||||
if newEvent.name == "change character" then
|
||||
myTypes.preloadChar(newEvent.var2)
|
||||
end
|
||||
|
||||
logging.log(string.lower(note[3]))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if eventChart.events then
|
||||
logging.log("Events are events")
|
||||
for index, event in next, eventChart.events do
|
||||
for index in next, event[2] do
|
||||
local newEvent = {
|
||||
@ -688,6 +705,7 @@ local function state(songName, songDifficulty)
|
||||
var1 = string.lower(event[2][index][2]),
|
||||
var2 = string.lower(event[2][index][3])
|
||||
}
|
||||
logging.log(newEvent.name)
|
||||
events[#events+1] = newEvent
|
||||
|
||||
if newEvent.name == "change character" then
|
||||
@ -696,20 +714,28 @@ local function state(songName, songDifficulty)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
::noChart::
|
||||
else
|
||||
|
||||
logging.log("No chart file")
|
||||
end
|
||||
|
||||
for index, event in next, chart.events do
|
||||
for index in next, event[2] do
|
||||
local newEvent = {
|
||||
time = event[1],
|
||||
name = string.lower(event[2][index][1]),
|
||||
var1 = string.lower(event[2][index][2]),
|
||||
var2 = string.lower(event[2][index][3])
|
||||
}
|
||||
events[#events+1] = newEvent
|
||||
if chart.events then
|
||||
for index, event in next, chart.events do
|
||||
for index in next, event[2] do
|
||||
local newEvent = {
|
||||
time = event[1],
|
||||
name = string.lower(event[2][index][1]),
|
||||
var1 = string.lower(event[2][index][2]),
|
||||
var2 = string.lower(event[2][index][3])
|
||||
}
|
||||
logging.log(newEvent.name)
|
||||
events[#events+1] = newEvent
|
||||
|
||||
if newEvent.name == "change character" then
|
||||
myTypes.preloadChar(newEvent.var2)
|
||||
if newEvent.name == "change character" then
|
||||
myTypes.preloadChar(newEvent.var2)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -44,6 +44,6 @@ return {
|
||||
|
||||
local lightAbove = myTypes.Image("images/stage/erect/lightAbove.png")
|
||||
lights.position = myTypes.Vector2(804, -117)
|
||||
lightAbove.layer = 3
|
||||
lightAbove.layer = 5
|
||||
end
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user