r3-next/levels/sfxtest.gd

53 lines
1.1 KiB
GDScript3
Raw Normal View History

2024-01-16 13:58:51 +01:00
extends Control
var player := AudioStreamPlayer.new()
func _ready():
2024-10-29 22:37:39 +01:00
#Input.set_mouse_mode(Input.MOUSE_MODE_HIDDEN)
2024-01-16 13:58:51 +01:00
add_child(player)
$"VBoxContainer/Frank".grab_focus()
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
pass
func _input(event):
# Mouse in viewport coordinates.
if Input.is_action_just_pressed("ui_cancel"):
_on_back_pressed()
2024-10-29 22:37:39 +01:00
if Input.is_key_pressed(KEY_X) || Input.is_joy_button_pressed(0,JOY_XBOX_X):
2024-01-16 13:58:51 +01:00
player.stop()
#print("Mouse Click/Unclick at: ", event.position)
# if highlighted == 1:
# _on_debug_pressed()
# if highlighted == 2:
# _on_exit_pressed()
# else:
# _on_start_pressed()
# elif Input.is_action_pressed("ui_up"):
# focus_next
func _on_back_pressed():
2024-10-29 22:37:39 +01:00
get_tree().change_scene("res://levels/soundtest.tscn")
2024-01-16 13:58:51 +01:00
func _on_frank_pressed():
player.stream = load(Global.sfxtracks[0])
player.play(0)
func _on_crash_pressed():
player.stream = load(Global.sfxtracks[1])
player.play(0)
func _on_complete_pressed():
player.stream = load(Global.sfxtracks[2])
player.play(0)