retrace/Characters/Player/PillTaker.gd

17 lines
466 B
GDScript

extends Spatial
var _animation: AnimationPlayer
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
# Taking a pill
if Input.is_action_just_pressed("take_pill"):
Pills.take_pill()
Logger.info("Player took a pill; new level: %s" % [Pills.get_round_level()])
_animation.play("PillTaking")
func _ready():
_animation = get_parent().get_node("PillAnimationPlayer") as AnimationPlayer
assert(null != _animation)