retrace/Characters/Player/PillTaker.gd

20 lines
582 B
GDScript3
Raw Normal View History

extends Spatial
2019-11-21 11:25:59 +01:00
2019-11-21 13:31:52 +01:00
var _animation: AnimationPlayer
2019-11-21 11:25:59 +01:00
# 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()])
2019-11-21 13:31:52 +01:00
_animation.play("PillTaking")
#_animation.playback_speed = _vel.length() / MOVE_SPEED
#Logger.warn("speed: " + String(_animation.playback_speed))
func _ready():
_animation = get_parent().get_node("AnimationPlayer") as AnimationPlayer
assert(null != _animation)