blob: ab4bdb203befe1794a618c0060aeb96678062500 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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)
|