midori-school/levels/ui/sfxtest.gd

72 lines
1.8 KiB
GDScript3
Raw Normal View History

2024-01-16 13:58:17 +01:00
extends Control
2024-09-07 18:25:58 +02:00
const gamepadtest = preload("res://gamepad.gd")
2024-01-16 13:58:17 +01:00
var player := AudioStreamPlayer.new()
func _ready():
Input.set_mouse_mode(Input.MOUSE_MODE_HIDDEN)
add_child(player)
2024-07-14 23:55:40 +02:00
player.mix_target = 1
2024-11-04 00:29:58 +01:00
player.bus = "SFX1"
2024-01-20 13:21:28 +01:00
$"BoxContainer/VBoxContainer/Game Over".grab_focus()
2024-01-16 13:58:17 +01:00
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
pass
func _level():
# This is like autoloading the scene, only
# it happens after already loading the main scene.
2024-11-04 00:29:58 +01:00
get_tree().change_scene("res://backgounds/disclaimer.tscn")
2024-01-16 13:58:17 +01:00
#Global.live = 1
#Global.gamelevel = randi() % 3
#if Global.gamelevel == 0:
# get_tree().change_scene_to_file("res://backgounds/galaxy.tscn")
#elif Global.gamelevel == 1:
# get_tree().change_scene_to_file("res://backgounds/wormhole.tscn")
#else:
# get_tree().change_scene_to_file("res://backgounds/abstract.tscn")
#get_tree().root.add_child(title)
#get_tree().root.remove_child(boot)
#boot.queue_free()
func _input(event):
2024-09-07 18:25:58 +02:00
gamepadtest.new(event)
2024-01-16 13:58:17 +01:00
# Mouse in viewport coordinates.
if Input.is_action_just_pressed("ui_cancel"):
_on_back_pressed()
2024-01-29 01:52:01 +01:00
if Input.is_action_just_pressed("stopmusic"):
2024-01-16 13:58:17 +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-11-04 00:29:58 +01:00
get_tree().change_scene("res://levels/ui/soundtest.tscn")
2024-01-16 13:58:17 +01:00
2024-01-20 13:21:28 +01:00
func _on_game_over_pressed():
player.stream = load(Global.sfxtracks[0])
player.play(0)
func _on_gauge_fill_pressed():
player.stream = load(Global.sfxtracks[1])
player.play(0)
2024-01-20 14:58:29 +01:00
func _on_explosion_pressed():
player.stream = load(Global.sfxtracks[2])
player.play(0)