midori-school/levels/ui/alsatest.gd

48 lines
1.4 KiB
GDScript3
Raw Normal View History

2024-06-27 00:22:53 +02:00
extends Control
2024-09-07 18:25:58 +02:00
const gamepadtest = preload("res://gamepad.gd")
2024-06-27 00:22:53 +02:00
var bgsound := AudioStreamPlayer.new()
2024-07-14 23:55:40 +02:00
var fl
var fr
var rl
var rr
2024-06-27 00:22:53 +02:00
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
2024-07-14 23:55:40 +02:00
fl = $Front_Left
fr = $Front_Right
rl = $Rear_Left
rr = $Rear_Right
2024-06-27 00:22:53 +02:00
add_child(bgsound)
2024-07-14 23:55:40 +02:00
#add_child(fl)
#add_child(fr)
2024-06-27 00:22:53 +02:00
bgsound.stream = load(Global.musictracks[21])
2024-07-14 23:55:40 +02:00
bgsound.mix_target = 1
bgsound.bus = &"Music"
#fl.mix_target = 1
#fr.mix_target = 1
#fl.stream = load("res://sfx/Front_Left.wav")
#fr.stream = load("res://sfx/Front_Right.wav")
2024-06-27 00:22:53 +02:00
bgsound.set_volume_db(-10)
2024-07-14 23:55:40 +02:00
#fl.set_volume_db(10)
#fr.set_volume_db(10)
2024-06-27 00:22:53 +02:00
bgsound.play(0)
func _input(event):
2024-09-07 18:25:58 +02:00
gamepadtest.new(event)
2024-06-27 00:22:53 +02:00
# Mouse in viewport coordinates.
if Input.is_action_just_pressed("ui_cancel"):
get_tree().change_scene_to_file("res://levels/ui/soundtest.tscn")
2024-07-14 23:55:40 +02:00
elif Input.is_action_pressed("ui_left") && Input.is_action_pressed("ui_up"):
2024-06-27 00:22:53 +02:00
fl.play(0)
2024-07-14 23:55:40 +02:00
elif Input.is_action_pressed("ui_right") && Input.is_action_pressed("ui_up"):
2024-06-27 00:22:53 +02:00
fr.play(0)
2024-07-14 23:55:40 +02:00
elif Input.is_action_pressed("ui_left") && Input.is_action_pressed("ui_down"):
rl.play(0)
elif Input.is_action_pressed("ui_right") && Input.is_action_pressed("ui_down"):
rr.play(0)
#if event is InputEventMouseMotion:
# bgsound.position = Vector3(event.position.x-640, 0, event.position.y-480)
2024-06-27 00:22:53 +02:00
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass