tweaked vending machine and added on off to boombox
This commit is contained in:
28
scripts/boombox.gd
Normal file
28
scripts/boombox.gd
Normal file
@@ -0,0 +1,28 @@
|
||||
extends RigidBody3D
|
||||
|
||||
@export var broken_object : Resource
|
||||
@onready var music = $Music/AudioStreamPlayer3D
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta):
|
||||
pass
|
||||
|
||||
func interact():
|
||||
if music.is_playing():
|
||||
music.stop()
|
||||
else:
|
||||
music.play()
|
||||
|
||||
func breaking(current_velocity):
|
||||
var spawn_broken = broken_object.instantiate()
|
||||
spawn_broken.position = global_position
|
||||
spawn_broken.transform.basis = global_transform.basis
|
||||
spawn_broken.rotation = rotation
|
||||
|
||||
get_tree().get_root().add_child(spawn_broken)
|
||||
queue_free()
|
||||
Reference in New Issue
Block a user