init
This commit is contained in:
18
interactables/dungeon/scripts/pushable_statue.gd
Normal file
18
interactables/dungeon/scripts/pushable_statue.gd
Normal file
@@ -0,0 +1,18 @@
|
||||
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()
|
||||
Reference in New Issue
Block a user