1
Fork 0
mirror of https://github.com/Steffo99/looping-for-loops.git synced 2024-11-22 08:04:23 +00:00
looping-for-loops/Scripts/Obstacles/Press.gd

23 lines
468 B
GDScript3
Raw Normal View History

extends StaticBody2D
class_name Press
var root_node: Node = null
var conductor: Conductor = null
func _subbeat(subbeat_num):
if subbeat_num % 24 == 0:
$AnimationPlayer.play("Stomp")
elif subbeat_num % 24 == 12:
$AnimationPlayer.play_backwards("Stomp")
func _enter_tree():
root_node = get_tree().current_scene
conductor = root_node.get_node("Conductor")
conductor.connect("subbeat", self, "_subbeat")
func _on_StompArea_body_entered(body):
print(body)