diff --git a/bootclick.gd b/bootclick.gd index cab8c1f..b2e8878 100644 --- a/bootclick.gd +++ b/bootclick.gd @@ -25,7 +25,7 @@ func _process(delta): func _input(event): # Mouse in viewport coordinates. - if !Global.sk && (event is InputEventMouseButton || Input.is_key_pressed(KEY_ENTER) || Input.is_joy_button_pressed(0,JOY_BUTTON_X) || Input.is_joy_button_pressed(0,JOY_BUTTON_Y) || Input.is_joy_button_pressed(0,JOY_BUTTON_A) || Input.is_joy_button_pressed(0,JOY_BUTTON_B) || Input.is_joy_button_pressed(0,JOY_BUTTON_BACK) || Input.is_joy_button_pressed(0,JOY_BUTTON_START) || Input.is_joy_button_pressed(0,JOY_BUTTON_RIGHT_SHOULDER) || Input.is_joy_button_pressed(0,JOY_BUTTON_LEFT_SHOULDER)): + if !Global.sk && (event is InputEventMouseButton || Input.is_action_pressed("ui_accept")): #print("Mouse Click/Unclick at: ", event.position) _title() diff --git a/bootclick.tscn b/bootclick.tscn index 4723b48..14876d2 100644 --- a/bootclick.tscn +++ b/bootclick.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=4 format=3 uid="uid://det6ve3x4aiq6"] +[gd_scene load_steps=4 format=3 uid="uid://dcc82vy3jkg0o"] [ext_resource type="Script" path="res://bootclick.gd" id="1_52bti"] [ext_resource type="PackedScene" uid="uid://dblfov80ngodu" path="res://selftest.tscn" id="3_jtnh5"] @@ -13,12 +13,12 @@ script = ExtResource("1_52bti") [node name="Label" type="Label" parent="."] layout_mode = 0 -offset_left = 105.0 +offset_left = 290.0 offset_top = 258.0 -offset_right = 453.0 -offset_bottom = 284.0 +offset_right = 949.0 +offset_bottom = 326.0 theme_override_font_sizes/font_size = 49 -text = "Press enter or a gamepad button to continue" +text = "Press enter or B to continue" horizontal_alignment = 1 vertical_alignment = 1 diff --git a/levels/debug.gd b/levels/debug.gd new file mode 100644 index 0000000..f266f47 --- /dev/null +++ b/levels/debug.gd @@ -0,0 +1,37 @@ +extends Control +func _ready(): + Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE) + $"VBoxContainer/Scene Selector".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_pressed("ui_cancel"): + _on_back_pressed() + #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_scene_selector_pressed(): + get_tree().change_scene_to_file("res://levels/scene.tscn") + + +func _on_sound_test_pressed(): + get_tree().change_scene_to_file("res://levels/soundtest.tscn") + + +func _on_back_pressed(): + get_tree().change_scene_to_file("res://levels/tmenu.tscn") diff --git a/levels/debug.tscn b/levels/debug.tscn new file mode 100644 index 0000000..39eb60a --- /dev/null +++ b/levels/debug.tscn @@ -0,0 +1,77 @@ +[gd_scene load_steps=7 format=3 uid="uid://vcmqr6ql7fg6"] + +[ext_resource type="Script" path="res://levels/debug.gd" id="1_gm5qw"] +[ext_resource type="VideoStream" path="res://backgounds/nebula_-_6044 (720p).ogv" id="2_l51wy"] +[ext_resource type="Script" path="res://nebula.gd" id="3_0jyxj"] + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_821nm"] +bg_color = Color(0, 0.8, 0, 1) + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_6u0xs"] +bg_color = Color(0, 0.8, 0, 1) + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_r2qrn"] +bg_color = Color(0, 0.8, 0, 1) + +[node name="Debug" type="Control"] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +script = ExtResource("1_gm5qw") + +[node name="nebula" type="VideoStreamPlayer" parent="."] +layout_mode = 0 +offset_right = 640.0 +offset_bottom = 368.0 +scale = Vector2(2, 1.96) +stream = ExtResource("2_l51wy") +autoplay = true +script = ExtResource("3_0jyxj") + +[node name="Game name" type="Label" parent="."] +layout_mode = 0 +offset_left = 339.0 +offset_top = 61.0 +offset_right = 991.0 +offset_bottom = 207.0 +theme_override_font_sizes/font_size = 106 +text = "Debug Menu" + +[node name="VBoxContainer" type="VBoxContainer" parent="."] +layout_mode = 1 +anchors_preset = 7 +anchor_left = 0.5 +anchor_top = 1.0 +anchor_right = 0.5 +anchor_bottom = 1.0 +offset_left = -129.5 +offset_top = -362.0 +offset_right = 129.5 +grow_horizontal = 2 +grow_vertical = 0 + +[node name="Scene Selector" type="Button" parent="VBoxContainer"] +layout_mode = 2 +theme_override_font_sizes/font_size = 80 +theme_override_styles/focus = SubResource("StyleBoxFlat_821nm") +text = "Scene Selector" + +[node name="Sound Test" type="Button" parent="VBoxContainer"] +layout_mode = 2 +theme_override_font_sizes/font_size = 80 +theme_override_styles/focus = SubResource("StyleBoxFlat_6u0xs") +text = "Sound Test" + +[node name="Back" type="Button" parent="VBoxContainer"] +layout_mode = 2 +theme_override_font_sizes/font_size = 80 +theme_override_styles/focus = SubResource("StyleBoxFlat_r2qrn") +text = "Back" + +[connection signal="finished" from="nebula" to="nebula" method="_on_finished"] +[connection signal="pressed" from="VBoxContainer/Scene Selector" to="." method="_on_scene_selector_pressed"] +[connection signal="pressed" from="VBoxContainer/Sound Test" to="." method="_on_sound_test_pressed"] +[connection signal="pressed" from="VBoxContainer/Back" to="." method="_on_back_pressed"] diff --git a/levels/scene.gd b/levels/scene.gd new file mode 100644 index 0000000..a171879 --- /dev/null +++ b/levels/scene.gd @@ -0,0 +1,91 @@ +extends Control +func _ready(): + Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE) + $"VBoxContainer/Galaxy".grab_focus() + +# 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. + 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): + # Mouse in viewport coordinates. + if Input.is_action_pressed("ui_cancel"): + _on_back_pressed() + #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(): + get_tree().change_scene_to_file("res://levels/debug.tscn") + + +func _on_galaxy_pressed(): + Global.live = 1 + Global.gamelevel = 1 + get_tree().change_scene_to_file("res://backgounds/galaxy.tscn") + + +func _on_wormhole_pressed(): + Global.live = 1 + Global.gamelevel = 1 + get_tree().change_scene_to_file("res://backgounds/wormhole.tscn") + + +func _on_abstract_pressed(): + Global.live = 1 + Global.gamelevel = 2 + get_tree().change_scene_to_file("res://backgounds/abstract.tscn") + + +func _on_galaxy_2_pressed(): + pass # Replace with function body. + + +func _on_lagoon_pressed(): + pass # Replace with function body. + + +func _on_orion_pressed(): + pass # Replace with function body. + + +func _on_space_pressed(): + pass # Replace with function body. + + +func _on_stars_pressed(): + pass # Replace with function body. + + +func _on_universe_pressed(): + pass # Replace with function body. + + +func _on_credits_pressed(): + get_tree().change_scene_to_file("res://levels/credits.tscn") diff --git a/levels/scene.tscn b/levels/scene.tscn new file mode 100644 index 0000000..9f28854 --- /dev/null +++ b/levels/scene.tscn @@ -0,0 +1,133 @@ +[gd_scene load_steps=7 format=3 uid="uid://cntn5tr2w3efj"] + +[ext_resource type="Script" path="res://levels/scene.gd" id="1_hxcrn"] +[ext_resource type="VideoStream" path="res://backgounds/nebula_-_6044 (720p).ogv" id="2_nvftm"] +[ext_resource type="Script" path="res://nebula.gd" id="3_6sds4"] + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_821nm"] +bg_color = Color(0, 0.8, 0, 1) + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_6u0xs"] +bg_color = Color(0, 0.8, 0, 1) + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_r2qrn"] +bg_color = Color(0, 0.8, 0, 1) + +[node name="Scene" type="Control"] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +script = ExtResource("1_hxcrn") + +[node name="nebula" type="VideoStreamPlayer" parent="."] +layout_mode = 0 +offset_right = 640.0 +offset_bottom = 368.0 +scale = Vector2(2, 1.96) +stream = ExtResource("2_nvftm") +autoplay = true +script = ExtResource("3_6sds4") + +[node name="Game name" type="Label" parent="."] +layout_mode = 0 +offset_left = 496.0 +offset_top = 3.0 +offset_right = 790.0 +offset_bottom = 73.0 +theme_override_font_sizes/font_size = 40 +text = "Scene selector" + +[node name="VBoxContainer" type="VBoxContainer" parent="."] +layout_mode = 1 +anchors_preset = 7 +anchor_left = 0.5 +anchor_top = 1.0 +anchor_right = 0.5 +anchor_bottom = 1.0 +offset_left = -129.5 +offset_top = -362.0 +offset_right = 129.5 +grow_horizontal = 2 +grow_vertical = 0 + +[node name="Galaxy" type="Button" parent="VBoxContainer"] +layout_mode = 2 +theme_override_font_sizes/font_size = 32 +theme_override_styles/focus = SubResource("StyleBoxFlat_821nm") +text = "Galaxy" + +[node name="Wormhole" type="Button" parent="VBoxContainer"] +layout_mode = 2 +theme_override_font_sizes/font_size = 32 +theme_override_styles/focus = SubResource("StyleBoxFlat_6u0xs") +text = "Wormhole" + +[node name="Abstract" type="Button" parent="VBoxContainer"] +layout_mode = 2 +theme_override_font_sizes/font_size = 32 +theme_override_styles/focus = SubResource("StyleBoxFlat_6u0xs") +text = "Abstract" + +[node name="Galaxy2" type="Button" parent="VBoxContainer"] +layout_mode = 2 +theme_override_font_sizes/font_size = 32 +theme_override_styles/focus = SubResource("StyleBoxFlat_6u0xs") +text = "Galaxy2" + +[node name="Lagoon" type="Button" parent="VBoxContainer"] +layout_mode = 2 +theme_override_font_sizes/font_size = 32 +theme_override_styles/focus = SubResource("StyleBoxFlat_6u0xs") +text = "Lagoon" + +[node name="Orion" type="Button" parent="VBoxContainer"] +layout_mode = 2 +theme_override_font_sizes/font_size = 32 +theme_override_styles/focus = SubResource("StyleBoxFlat_6u0xs") +text = "Orion" + +[node name="Space" type="Button" parent="VBoxContainer"] +layout_mode = 2 +theme_override_font_sizes/font_size = 32 +theme_override_styles/focus = SubResource("StyleBoxFlat_6u0xs") +text = "Space" + +[node name="Stars" type="Button" parent="VBoxContainer"] +layout_mode = 2 +theme_override_font_sizes/font_size = 32 +theme_override_styles/focus = SubResource("StyleBoxFlat_6u0xs") +text = "Stars" + +[node name="Universe" type="Button" parent="VBoxContainer"] +layout_mode = 2 +theme_override_font_sizes/font_size = 32 +theme_override_styles/focus = SubResource("StyleBoxFlat_6u0xs") +text = "Universe" + +[node name="Credits" type="Button" parent="VBoxContainer"] +layout_mode = 2 +theme_override_font_sizes/font_size = 32 +theme_override_styles/focus = SubResource("StyleBoxFlat_6u0xs") +text = "Credits" + +[node name="Back" type="Button" parent="VBoxContainer"] +layout_mode = 2 +theme_override_font_sizes/font_size = 32 +theme_override_styles/focus = SubResource("StyleBoxFlat_r2qrn") +text = "Back" + +[connection signal="finished" from="nebula" to="nebula" method="_on_finished"] +[connection signal="pressed" from="VBoxContainer/Galaxy" to="." method="_on_galaxy_pressed"] +[connection signal="pressed" from="VBoxContainer/Wormhole" to="." method="_on_wormhole_pressed"] +[connection signal="pressed" from="VBoxContainer/Abstract" to="." method="_on_abstract_pressed"] +[connection signal="pressed" from="VBoxContainer/Galaxy2" to="." method="_on_galaxy_2_pressed"] +[connection signal="pressed" from="VBoxContainer/Lagoon" to="." method="_on_lagoon_pressed"] +[connection signal="pressed" from="VBoxContainer/Orion" to="." method="_on_orion_pressed"] +[connection signal="pressed" from="VBoxContainer/Space" to="." method="_on_space_pressed"] +[connection signal="pressed" from="VBoxContainer/Stars" to="." method="_on_stars_pressed"] +[connection signal="pressed" from="VBoxContainer/Universe" to="." method="_on_universe_pressed"] +[connection signal="pressed" from="VBoxContainer/Credits" to="." method="_on_credits_pressed"] +[connection signal="pressed" from="VBoxContainer/Back" to="." method="_on_back_pressed"] diff --git a/levels/soundtest.gd b/levels/soundtest.gd new file mode 100644 index 0000000..616ac93 --- /dev/null +++ b/levels/soundtest.gd @@ -0,0 +1,83 @@ +extends Control +func _ready(): + Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE) + $"VBoxContainer/Title Screen".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_pressed("ui_cancel"): + _on_back_pressed() + #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(): + get_tree().change_scene_to_file("res://levels/debug.tscn") + + +func _on_title_screen_pressed(): + pass # Replace with function body. + + +func _on_galaxy_pressed(): + pass # Replace with function body. + + +func _on_wormhole_pressed(): + pass # Replace with function body. + + +func _on_abstract_pressed(): + pass # Replace with function body. + + +func _on_galaxy_2_pressed(): + pass # Replace with function body. + + +func _on_lagoon_pressed(): + pass # Replace with function body. + + +func _on_orion_pressed(): + pass # Replace with function body. + + +func _on_space_pressed(): + pass # Replace with function body. + + +func _on_stars_pressed(): + pass # Replace with function body. + + +func _on_universe_pressed(): + pass # Replace with function body. + + +func _on_credits_1_pressed(): + pass # Replace with function body. + + +func _on_credits_2_pressed(): + pass # Replace with function body. + + +func _on_credits_3_pressed(): + pass # Replace with function body. diff --git a/levels/soundtest.tscn b/levels/soundtest.tscn new file mode 100644 index 0000000..17b4dbc --- /dev/null +++ b/levels/soundtest.tscn @@ -0,0 +1,163 @@ +[gd_scene load_steps=7 format=3 uid="uid://bpn8rshcjn33c"] + +[ext_resource type="Script" path="res://levels/soundtest.gd" id="1_3bg6p"] +[ext_resource type="VideoStream" path="res://backgounds/nebula_-_6044 (720p).ogv" id="2_abtft"] +[ext_resource type="Script" path="res://nebula.gd" id="3_c33nl"] + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_cprm3"] +bg_color = Color(0, 0.8, 0, 1) + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_alctd"] +bg_color = Color(0, 0.8, 0, 1) + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_0dqsq"] +bg_color = Color(0, 0.8, 0, 1) + +[node name="Soundtest" type="Control"] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +script = ExtResource("1_3bg6p") + +[node name="nebula" type="VideoStreamPlayer" parent="."] +layout_mode = 0 +offset_right = 640.0 +offset_bottom = 368.0 +scale = Vector2(2, 1.96) +stream = ExtResource("2_abtft") +autoplay = true +script = ExtResource("3_c33nl") + +[node name="Game name" type="Label" parent="."] +layout_mode = 0 +offset_left = 496.0 +offset_top = 3.0 +offset_right = 790.0 +offset_bottom = 73.0 +theme_override_font_sizes/font_size = 40 +text = "Sound Test" + +[node name="Stop" type="Label" parent="."] +layout_mode = 0 +offset_left = 5.0 +offset_top = 672.0 +offset_right = 444.0 +offset_bottom = 708.0 +theme_override_font_sizes/font_size = 22 +text = "Press X or Spacebar to stop music playback" + +[node name="VBoxContainer" type="VBoxContainer" parent="."] +layout_mode = 1 +anchors_preset = 7 +anchor_left = 0.5 +anchor_top = 1.0 +anchor_right = 0.5 +anchor_bottom = 1.0 +offset_left = -129.5 +offset_top = -362.0 +offset_right = 129.5 +grow_horizontal = 2 +grow_vertical = 0 + +[node name="Title Screen" type="Button" parent="VBoxContainer"] +layout_mode = 2 +theme_override_font_sizes/font_size = 25 +theme_override_styles/focus = SubResource("StyleBoxFlat_cprm3") +text = "Title Screen: X-Force Theme" + +[node name="Galaxy" type="Button" parent="VBoxContainer"] +layout_mode = 2 +theme_override_font_sizes/font_size = 25 +theme_override_styles/focus = SubResource("StyleBoxFlat_cprm3") +text = "Galaxy" + +[node name="Wormhole" type="Button" parent="VBoxContainer"] +layout_mode = 2 +theme_override_font_sizes/font_size = 25 +theme_override_styles/focus = SubResource("StyleBoxFlat_alctd") +text = "Wormhole" + +[node name="Abstract" type="Button" parent="VBoxContainer"] +layout_mode = 2 +theme_override_font_sizes/font_size = 25 +theme_override_styles/focus = SubResource("StyleBoxFlat_alctd") +text = "Abstract" + +[node name="Galaxy2" type="Button" parent="VBoxContainer"] +layout_mode = 2 +theme_override_font_sizes/font_size = 25 +theme_override_styles/focus = SubResource("StyleBoxFlat_alctd") +text = "Galaxy2" + +[node name="Lagoon" type="Button" parent="VBoxContainer"] +layout_mode = 2 +theme_override_font_sizes/font_size = 25 +theme_override_styles/focus = SubResource("StyleBoxFlat_alctd") +text = "Lagoon" + +[node name="Orion" type="Button" parent="VBoxContainer"] +layout_mode = 2 +theme_override_font_sizes/font_size = 25 +theme_override_styles/focus = SubResource("StyleBoxFlat_alctd") +text = "Orion" + +[node name="Space" type="Button" parent="VBoxContainer"] +layout_mode = 2 +theme_override_font_sizes/font_size = 25 +theme_override_styles/focus = SubResource("StyleBoxFlat_alctd") +text = "Space" + +[node name="Stars" type="Button" parent="VBoxContainer"] +layout_mode = 2 +theme_override_font_sizes/font_size = 25 +theme_override_styles/focus = SubResource("StyleBoxFlat_alctd") +text = "Stars" + +[node name="Universe" type="Button" parent="VBoxContainer"] +layout_mode = 2 +theme_override_font_sizes/font_size = 25 +theme_override_styles/focus = SubResource("StyleBoxFlat_alctd") +text = "Universe" + +[node name="Credits 1" type="Button" parent="VBoxContainer"] +layout_mode = 2 +theme_override_font_sizes/font_size = 25 +theme_override_styles/focus = SubResource("StyleBoxFlat_alctd") +text = "Credits 1" + +[node name="Credits 2" type="Button" parent="VBoxContainer"] +layout_mode = 2 +theme_override_font_sizes/font_size = 25 +theme_override_styles/focus = SubResource("StyleBoxFlat_alctd") +text = "Credits 2" + +[node name="Credits 3" type="Button" parent="VBoxContainer"] +layout_mode = 2 +theme_override_font_sizes/font_size = 25 +theme_override_styles/focus = SubResource("StyleBoxFlat_alctd") +text = "Credits 3" + +[node name="Back" type="Button" parent="VBoxContainer"] +layout_mode = 2 +theme_override_font_sizes/font_size = 25 +theme_override_styles/focus = SubResource("StyleBoxFlat_0dqsq") +text = "Back" + +[connection signal="finished" from="nebula" to="nebula" method="_on_finished"] +[connection signal="pressed" from="VBoxContainer/Title Screen" to="." method="_on_title_screen_pressed"] +[connection signal="pressed" from="VBoxContainer/Galaxy" to="." method="_on_galaxy_pressed"] +[connection signal="pressed" from="VBoxContainer/Wormhole" to="." method="_on_wormhole_pressed"] +[connection signal="pressed" from="VBoxContainer/Abstract" to="." method="_on_abstract_pressed"] +[connection signal="pressed" from="VBoxContainer/Galaxy2" to="." method="_on_galaxy_2_pressed"] +[connection signal="pressed" from="VBoxContainer/Lagoon" to="." method="_on_lagoon_pressed"] +[connection signal="pressed" from="VBoxContainer/Orion" to="." method="_on_orion_pressed"] +[connection signal="pressed" from="VBoxContainer/Space" to="." method="_on_space_pressed"] +[connection signal="pressed" from="VBoxContainer/Stars" to="." method="_on_stars_pressed"] +[connection signal="pressed" from="VBoxContainer/Universe" to="." method="_on_universe_pressed"] +[connection signal="pressed" from="VBoxContainer/Credits 1" to="." method="_on_credits_1_pressed"] +[connection signal="pressed" from="VBoxContainer/Credits 2" to="." method="_on_credits_2_pressed"] +[connection signal="pressed" from="VBoxContainer/Credits 3" to="." method="_on_credits_3_pressed"] +[connection signal="pressed" from="VBoxContainer/Back" to="." method="_on_back_pressed"] diff --git a/levels/tmenu.gd b/levels/tmenu.gd new file mode 100644 index 0000000..25505b4 --- /dev/null +++ b/levels/tmenu.gd @@ -0,0 +1,50 @@ +extends Control +func _ready(): + Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE) + $VBoxContainer/Start.grab_focus() + +# 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. + 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): + # Mouse in viewport coordinates. +# if Input.is_key_pressed(KEY_ENTER) || Input.is_joy_button_pressed(0,JOY_BUTTON_B): + #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_start_pressed(): + _level() + #pass # Replace with function body. + + +func _on_debug_pressed(): + get_tree().change_scene_to_file("res://levels/debug.tscn") + + +func _on_exit_pressed(): + get_tree().quit() + #pass # Replace with function body. diff --git a/levels/tmenu.tscn b/levels/tmenu.tscn index 8fe0273..9f1e130 100644 --- a/levels/tmenu.tscn +++ b/levels/tmenu.tscn @@ -1,4 +1,17 @@ -[gd_scene format=3 uid="uid://b0anr0rhqs0tu"] +[gd_scene load_steps=7 format=3 uid="uid://b0anr0rhqs0tu"] + +[ext_resource type="VideoStream" path="res://backgounds/nebula_-_6044 (720p).ogv" id="1_33b4o"] +[ext_resource type="Script" path="res://levels/tmenu.gd" id="1_w3aym"] +[ext_resource type="Script" path="res://nebula.gd" id="2_x35ws"] + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_821nm"] +bg_color = Color(0, 0.8, 0, 1) + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_6u0xs"] +bg_color = Color(0, 0.8, 0, 1) + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_r2qrn"] +bg_color = Color(0, 0.8, 0, 1) [node name="Tmenu" type="Control"] layout_mode = 3 @@ -7,6 +20,16 @@ anchor_right = 1.0 anchor_bottom = 1.0 grow_horizontal = 2 grow_vertical = 2 +script = ExtResource("1_w3aym") + +[node name="nebula" type="VideoStreamPlayer" parent="."] +layout_mode = 0 +offset_right = 640.0 +offset_bottom = 368.0 +scale = Vector2(2, 1.96) +stream = ExtResource("1_33b4o") +autoplay = true +script = ExtResource("2_x35ws") [node name="Game name" type="Label" parent="."] layout_mode = 0 @@ -19,19 +42,36 @@ text = "The Red Robot Radio" [node name="VBoxContainer" type="VBoxContainer" parent="."] layout_mode = 1 -anchors_preset = 8 +anchors_preset = 7 anchor_left = 0.5 -anchor_top = 0.5 +anchor_top = 1.0 anchor_right = 0.5 -anchor_bottom = 0.5 -offset_left = -23.0 -offset_top = -20.0 -offset_right = 23.0 -offset_bottom = 20.0 +anchor_bottom = 1.0 +offset_left = -129.5 +offset_top = -362.0 +offset_right = 129.5 grow_horizontal = 2 -grow_vertical = 2 +grow_vertical = 0 -[node name="Button" type="Button" parent="VBoxContainer"] +[node name="Start" type="Button" parent="VBoxContainer"] layout_mode = 2 theme_override_font_sizes/font_size = 80 +theme_override_styles/focus = SubResource("StyleBoxFlat_821nm") text = "Start" + +[node name="Debug" type="Button" parent="VBoxContainer"] +layout_mode = 2 +theme_override_font_sizes/font_size = 80 +theme_override_styles/focus = SubResource("StyleBoxFlat_6u0xs") +text = "Debug" + +[node name="Exit" type="Button" parent="VBoxContainer"] +layout_mode = 2 +theme_override_font_sizes/font_size = 80 +theme_override_styles/focus = SubResource("StyleBoxFlat_r2qrn") +text = "Exit" + +[connection signal="finished" from="nebula" to="nebula" method="_on_finished"] +[connection signal="pressed" from="VBoxContainer/Start" to="." method="_on_start_pressed"] +[connection signal="pressed" from="VBoxContainer/Debug" to="." method="_on_debug_pressed"] +[connection signal="pressed" from="VBoxContainer/Exit" to="." method="_on_exit_pressed"] diff --git a/project.godot b/project.godot index 1c0ae09..f99ab65 100644 --- a/project.godot +++ b/project.godot @@ -27,6 +27,23 @@ window/size/viewport_height=720 window/size/mode=3 window/stretch/mode="viewport" +[input] + +ui_accept={ +"deadzone": 0.5, +"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194309,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null) +, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194310,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null) +, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":32,"physical_keycode":0,"key_label":0,"unicode":32,"echo":false,"script":null) +, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":1,"pressure":0.0,"pressed":false,"script":null) +] +} +ui_cancel={ +"deadzone": 0.5, +"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194305,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null) +, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":0,"pressure":0.0,"pressed":false,"script":null) +] +} + [rendering] renderer/rendering_method="gl_compatibility" diff --git a/title.gd b/title.gd index a9976b8..f9064b8 100644 --- a/title.gd +++ b/title.gd @@ -31,10 +31,11 @@ func _process(delta): func _input(event): # Mouse in viewport coordinates. - if (Time.get_ticks_msec() - wait) >= 1000 && (event is InputEventMouseButton || Input.is_key_pressed(KEY_ENTER) || Input.is_joy_button_pressed(0,JOY_BUTTON_B)): + if (Time.get_ticks_msec() - wait) >= 1000 && (event is InputEventMouseButton || Input.is_action_pressed("ui_accept")): #print("Mouse Click/Unclick at: ", event.position) - _level() - elif (Time.get_ticks_msec() - wait) >= 1000 && (Input.is_key_pressed(KEY_ESCAPE) || Input.is_joy_button_pressed(0,JOY_BUTTON_A)): + get_tree().change_scene_to_file("res://levels/tmenu.tscn") + #_level() + elif (Time.get_ticks_msec() - wait) >= 1000 && (Input.is_action_pressed("ui_cancel")): get_tree().quit() func _level():