-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSwap Notes.lua
More file actions
108 lines (95 loc) · 2.63 KB
/
Copy pathSwap Notes.lua
File metadata and controls
108 lines (95 loc) · 2.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
-- Event notes hooks
alreadySwapped = false;
intendedStrumPos = {};
function onCountdownTick(counter)
if counter == 0 then
for i = 0, 3 do
intendedStrumPos[i] = getPropertyFromGroup('playerStrums', i, 'x');
end
end
end
function onEvent(name, value1, value2)
if name == "Flip Notes" then
oldNoteX = intendedStrumPos[0];
intendedStrumPos[0] = intendedStrumPos[3];
intendedStrumPos[3] = oldNoteX;
oldNoteX = intendedStrumPos[1];
intendedStrumPos[1] = intendedStrumPos[2];
intendedStrumPos[2] = oldNoteX;
elseif name == "Swap Notes" then
note1 = tonumber(value1);
note2 = tonumber(value2);
swapNotesFromStrum(note1, note2);
if not lowQuality then
for i = 0, 3 do
tag = 'psychicNoteTrail'..i;
setProperty(tag..'.alpha', 0.0001);
doTweenAlpha(tag..'alphaTweenThing', tag, 0.5, 0.25, 'linear');
end
runTimer('removeTrailThing', 0.3);
end
end
end
function swapNotesFromStrum(note1, note2)
lastArrowPositions = {};
lastArrowPositions[note1] = intendedStrumPos[note1];
lastArrowPositions[note2] = intendedStrumPos[note2];
for i = 0, 1 do
if note1 == note2 then
return;
elseif note1 > note2 then
oldNote = note2;
note2 = note1;
note1 = oldNote;
end
swapped = false;
if intendedStrumPos[note2] < intendedStrumPos[note1] then
swapped = true;
end
newPos = note2;
spr = note1;
if not (i == 0) then
newPos = note1;
spr = note2;
end
rot = 40;
if getPropertyFromGroup('playerStrums', i, 'ID') > 1 then
rot = -40;
end
if swapped then
if newPos == note1 then
newPos = note2;
else
newPos = note1;
end
rot = -rot;
end
newX = 0;
if i == 0 then
newX = lastArrowPositions[note2];
noteTweenX('flipNotesTwn'..note1, note1 + 4, newX, 0.3, 'linear');
noteTweenAngle('flipNotesAngleTwn'..note1, note1 + 4, rot, 0.2, 'linear');
runTimer('flipNotesAngleTimer'..note1, 0.25);
intendedStrumPos[note1] = newX;
else
newX = lastArrowPositions[note1];
noteTweenX('flipNotesTwn'..note2, note2 + 4, newX, 0.3, 'linear');
noteTweenAngle('flipNotesAngleTwn'..note2, note2 + 4, rot, 0.2, 'linear');
runTimer('flipNotesAngleTimer'..note2, 0.25);
intendedStrumPos[note2] = newX;
end
end
end
function onTimerCompleted(tag, loops, loopsLeft)
for i = 0, 3 do
if tag == 'flipNotesAngleTimer'..i then
noteTweenAngle('flipNotesAngleTwn'..i, i + 4, 0, 0.4, 'linear');
end
end
if tag == 'removeTrailThing' then
for i = 0, 3 do
tag = 'psychicNoteTrail'..i;
doTweenAlpha(tag..'alphaTweenThing', tag, 0.0, 0.2, 'linear');
end
end
end