27 lines
556 B
GDScript
27 lines
556 B
GDScript
extends RigidBody
|
|
|
|
|
|
onready var anim = get_node("AnimationPlayer")
|
|
onready var skeleton = get_node("Armature/Skeleton")
|
|
onready var area = get_node("Armature/Skeleton/BoneAttachment/TouchArea")
|
|
|
|
|
|
func _ready():
|
|
area.connect("body_entered", self, "arm_collided")
|
|
|
|
|
|
func arm_collided(body):
|
|
if body.name != "Arm":
|
|
print("Entered")
|
|
apply_impulse(area.transform.origin, Vector3.UP * 10.0)
|
|
|
|
|
|
func _unhandled_input(event):
|
|
if event is InputEventKey:
|
|
if event.pressed and event.scancode == KEY_A:
|
|
play()
|
|
|
|
|
|
func play():
|
|
anim.play("ArmatureAction001")
|