2020-10-03 23:48:55 +00:00
|
|
|
extends ScrollingBlock
|
2020-10-03 22:33:54 +00:00
|
|
|
class_name Press
|
|
|
|
|
2020-10-03 23:48:55 +00:00
|
|
|
export(int, 0, 47) var subbeat_offset = 0
|
2020-10-03 22:33:54 +00:00
|
|
|
|
|
|
|
var root_node: Node = null
|
|
|
|
var conductor: Conductor = null
|
|
|
|
|
|
|
|
|
|
|
|
func _subbeat(subbeat_num):
|
2020-10-03 23:48:55 +00:00
|
|
|
if (subbeat_num - subbeat_offset) % 48 == 0:
|
2020-10-03 22:33:54 +00:00
|
|
|
$AnimationPlayer.play("Stomp")
|
2020-10-03 23:48:55 +00:00
|
|
|
elif (subbeat_num - subbeat_offset) % 48 == 24:
|
2020-10-03 22:33:54 +00:00
|
|
|
$AnimationPlayer.play_backwards("Stomp")
|
|
|
|
|
|
|
|
func _enter_tree():
|
2020-10-03 23:48:55 +00:00
|
|
|
$CollisionShape2D.shape = RectangleShape2D.new()
|
|
|
|
$CollisionShape2D.shape.extents = Vector2(80, 76.5)
|
|
|
|
$Bottom/StompArea/CollisionShape2D.shape = RectangleShape2D.new()
|
|
|
|
$Bottom/StompArea/CollisionShape2D.shape.extents = Vector2(78, 4)
|
2020-10-03 22:33:54 +00:00
|
|
|
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)
|