Compare commits

..

2 Commits

Author SHA1 Message Date
Spencer Killen ff8c3ef752
Merge branch 'master' of https://git.sjkillen.ca/sjkillen/hurrmmm 2023-11-11 22:20:14 -07:00
Spencer Killen a7c1092f50
a 2023-11-11 22:20:13 -07:00
1 changed files with 16 additions and 1 deletions

View File

@ -9,11 +9,26 @@ var target: Targetable = null
var camera_tweening = false var camera_tweening = false
var time_targets := Dictionary()
func _ready(): func _ready():
set_target(initial_target, false) set_target(initial_target, false)
camera.set_as_top_level(true) camera.set_as_top_level(true)
ControllerEventBus.billiard_touched_billiard.connect(_on_billiard_touched_billiard) ControllerEventBus.billiard_touched_billiard.connect(_on_billiard_touched_billiard)
TAS_System.FrameIncremented.connect(frame_inc)
TAS_System.FramesAdvanced.connect(frames_change)
TAS_System.FramesRegressed.connect(frames_change)
func frame_inc(frame: int):
time_targets[frame] = target
func frames_change(start: int, end: int):
if time_targets[end] != target:
set_target(time_targets[end].get_billiard())
func _on_billiard_touched_billiard(who: Billiard, touched: Billiard): func _on_billiard_touched_billiard(who: Billiard, touched: Billiard):
var who_target = Targetable.is_targetable(who) var who_target = Targetable.is_targetable(who)
if who_target != target or who.can_hit: if who_target != target or who.can_hit:
@ -71,8 +86,8 @@ func release():
%ChargeReleaseSound.volume_db = get_charge() * 12 %ChargeReleaseSound.volume_db = get_charge() * 12
%ChargeReleaseSound.play() %ChargeReleaseSound.play()
var billiard := target.get_billiard() var billiard := target.get_billiard()
billiard.hit((target.global_position - %camera_spot.global_position).normalized(), get_charge())
TAS_System.StartIncrementingFrames() TAS_System.StartIncrementingFrames()
billiard.hit((target.global_position - %camera_spot.global_position).normalized(), get_charge())
%radial_ui.set_charge(0.0) %radial_ui.set_charge(0.0)
%ChargeSound.stop() %ChargeSound.stop()