diff options
Diffstat (limited to 'bumper.gd')
-rw-r--r-- | bumper.gd | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/bumper.gd b/bumper.gd new file mode 100644 index 0000000..ab4bdb2 --- /dev/null +++ b/bumper.gd @@ -0,0 +1,22 @@ +extends StaticBody2D + + +@export var force: float = 3.0 +@export var hit_sound: AudioStreamPlayer +@export var animation_player: AnimationPlayer + + +func _ready() -> void: + animation_player.animation_finished.connect(func(anim_name: StringName): + if anim_name == "hit": + animation_player.play("default") + ) + + +func animate_bump() -> void: + animation_player.play("hit") + hit_sound.play() + + +func get_impulse() -> Vector2: + return Vector2(force, force) |