forked from LinoBigatti/TAC
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcircleXXLClockWise.gd
59 lines (46 loc) · 1.6 KB
/
circleXXLClockWise.gd
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
# Any script that interacts with the Project Heartbeat API is licensed under the
# AGPLv3 for the general public and also gives an exclusive, royalty-free license
# for EIRTeam to incorporate it in the game
#
# circle 3.5 script
# By Lino & NeoRash
# Made with Love
#
extends ScriptRunnerScript # Do not remove this
func run_script() -> int:
# Initialize variables
var size = 3.5 # Circle Size
var amp = 96 * size # Amplitude = regular Spacing * Circle Size
var frq = 180000 * size # Every 4 quarter time is a full Circle on 240000 frq
var dir = 1 # 1 for c, -1 for cc
var sustainCompensation = 0
# Get selected timing points
var selected_timing_points := get_selected_timing_points()
# Flip them pokeWHAT
selected_timing_points.invert()
# Iterate over them
for i in range(selected_timing_points.size()):
# Get point
var point := selected_timing_points[i] as HBTimingPoint
# Get bpm
var bpm := get_bpm_at_time(point.time)
# Fancy math
var t = point.time - sustainCompensation
var z = t * TAU
var x = amp * cos(z * dir * bpm / frq) + 960
var y = amp * sin(z * dir * bpm / frq) + 540
var pos = Vector2(x, y)
# Compensate for sustain notes
if point is HBSustainNote:
sustainCompensation += point.end_time - point.time
# Set position
set_timing_point_property(point, "position", pos)
# Calculate angle to the center of the screen
var a = atan2(y - 540, x - 960)
a *= (180 / PI)
a += 180
# Set angle
set_timing_point_property(point, "entry_angle", a)
# Return OK to apply the script's changes, return anything else (such as -1)
# to cancel it
return OK