19 lines
454 B
GDScript
19 lines
454 B
GDScript
class_name PushableStatute extends RigidBody2D
|
|
|
|
@onready var audio: AudioStreamPlayer2D = $AudioStreamPlayer2D
|
|
|
|
@export var push_speed := 30.0
|
|
|
|
var push_direction := Vector2.ZERO :
|
|
set = set_push
|
|
|
|
func _physics_process(_delta: float) -> void:
|
|
linear_velocity = push_direction * push_speed
|
|
|
|
func set_push(new_push_direction: Vector2) -> void:
|
|
push_direction = new_push_direction
|
|
if push_direction == Vector2.ZERO:
|
|
audio.stop()
|
|
else:
|
|
audio.play()
|