diff --git a/scenes/cockpit.tscn b/scenes/cockpit.tscn index d8d936a..38354fe 100644 --- a/scenes/cockpit.tscn +++ b/scenes/cockpit.tscn @@ -1,3 +1,40 @@ -[gd_scene format=3 uid="uid://dhnyno80w01m"] +[gd_scene load_steps=7 format=3 uid="uid://dhnyno80w01m"] + +[ext_resource type="Script" path="res://scripts/cockpit.gd" id="1_aq0f0"] +[ext_resource type="Texture2D" uid="uid://oku8lbst4etl" path="res://sprites/Inside cockpit area screen.png" id="1_i74mr"] +[ext_resource type="AudioStream" uid="uid://o1fpcdhcrr3e" path="res://audio/Another Night (inside cockpit music) .mp3" id="2_45pct"] +[ext_resource type="Texture2D" uid="uid://c70xoliuvmds" path="res://sprites/Sun.png" id="3_ev3sk"] +[ext_resource type="Texture2D" uid="uid://chprpjr43mx04" path="res://sprites/Polaris.png" id="4_6y6js"] +[ext_resource type="Texture2D" uid="uid://blpw7bgteup87" path="res://sprites/Proxima centauri.png" id="5_0utwh"] [node name="Cockpit" type="Node2D"] +script = ExtResource("1_aq0f0") + +[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."] +stream = ExtResource("2_45pct") + +[node name="InsideCockpitAreaScreen" type="Sprite2D" parent="."] +position = Vector2(576, 324) +scale = Vector2(2.45106, 2.4) +texture = ExtResource("1_i74mr") + +[node name="Sun" type="TextureButton" parent="."] +offset_left = 728.0 +offset_top = 64.0 +offset_right = 963.0 +offset_bottom = 199.0 +texture_normal = ExtResource("3_ev3sk") + +[node name="Polaris" type="TextureButton" parent="."] +offset_left = 463.0 +offset_top = 200.0 +offset_right = 698.0 +offset_bottom = 335.0 +texture_normal = ExtResource("4_6y6js") + +[node name="Proxima_centauri" type="TextureButton" parent="."] +offset_left = 205.0 +offset_top = 72.0 +offset_right = 440.0 +offset_bottom = 207.0 +texture_normal = ExtResource("5_0utwh") diff --git a/scenes/stages/stage1.tscn b/scenes/stages/stage1.tscn index 0a07d69..ab7112a 100644 --- a/scenes/stages/stage1.tscn +++ b/scenes/stages/stage1.tscn @@ -2,6 +2,7 @@ [ext_resource type="Script" path="res://scripts/Player.gd" id="1_4dh24"] [ext_resource type="Texture2D" uid="uid://dhgvwxivav0sa" path="res://sprites/Astronaut Sprite 1 fire.png" id="2_7ny1k"] +[ext_resource type="AudioStream" uid="uid://dfaswthopohch" path="res://audio/The Journey (final ver.).mp3" id="3_07jfn"] [ext_resource type="Script" path="res://scripts/Stage1/Clue1.gd" id="3_rns28"] [ext_resource type="Script" path="res://scripts/Stage1/Clue2.gd" id="4_pv2ro"] [ext_resource type="Script" path="res://scripts/Stage1/Clue3.gd" id="5_2j6ve"] @@ -11,7 +12,6 @@ [ext_resource type="Script" path="res://scripts/Stage1/AnswerGUI.gd" id="8_yubbe"] [ext_resource type="Texture2D" uid="uid://ceo8fmyqrium1" path="res://sprites/Stars sheet.png" id="9_5uxs5"] [ext_resource type="Script" path="res://scripts/Starry background.gd" id="10_njl88"] -[ext_resource type="AudioStream" uid="uid://o1fpcdhcrr3e" path="res://audio/Another Night (inside cockpit music) .mp3" id="12_hpkl2"] [sub_resource type="AtlasTexture" id="AtlasTexture_0fy8c"] atlas = ExtResource("9_5uxs5") @@ -102,7 +102,7 @@ frame = 6 script = ExtResource("10_njl88") [node name="Background" type="AudioStreamPlayer" parent="Starry background"] -stream = ExtResource("12_hpkl2") +stream = ExtResource("3_07jfn") [node name="Player" type="CharacterBody2D" parent="." groups=["player"]] script = ExtResource("1_4dh24") @@ -244,6 +244,7 @@ offset_right = 456.0 offset_bottom = 514.0 text = "Sun" +[connection signal="finished" from="Starry background/Background" to="Starry background" method="_on_background_finished"] [connection signal="body_entered" from="Clue1" to="Clue1" method="_on_body_entered"] [connection signal="body_exited" from="Clue1" to="Clue1" method="_on_body_exited"] [connection signal="body_entered" from="Clue2" to="Clue2" method="_on_body_entered"] diff --git a/scenes/stages/stage2.tscn b/scenes/stages/stage2.tscn new file mode 100644 index 0000000..abc47e4 --- /dev/null +++ b/scenes/stages/stage2.tscn @@ -0,0 +1,274 @@ +[gd_scene load_steps=28 format=3 uid="uid://dvanpqruglgkd"] + +[ext_resource type="Texture2D" uid="uid://ceo8fmyqrium1" path="res://sprites/Stars sheet.png" id="1_uk30u"] +[ext_resource type="Script" path="res://scripts/Starry background.gd" id="2_6xdch"] +[ext_resource type="AudioStream" uid="uid://dfaswthopohch" path="res://audio/The Journey (final ver.).mp3" id="3_0g6qg"] +[ext_resource type="Script" path="res://scripts/Player.gd" id="4_n20oe"] +[ext_resource type="Texture2D" uid="uid://dhgvwxivav0sa" path="res://sprites/Astronaut Sprite 1 fire.png" id="5_hgogw"] +[ext_resource type="Script" path="res://scripts/Stage2/Clue1.gd" id="6_8v7fc"] +[ext_resource type="Texture2D" uid="uid://c70xoliuvmds" path="res://sprites/Sun.png" id="7_08fvd"] +[ext_resource type="Script" path="res://scripts/Stage2/Clue2.gd" id="8_i7dl7"] +[ext_resource type="Script" path="res://scripts/Stage2/Clue3.gd" id="9_c5eqc"] +[ext_resource type="Script" path="res://scripts/Stage2/Clue4.gd" id="10_wpwbu"] +[ext_resource type="Script" path="res://scripts/Stage2/Clue5.gd" id="11_rlvsd"] +[ext_resource type="Script" path="res://scripts/Stage2/AnswerGUI.gd" id="12_o6d3n"] + +[sub_resource type="AtlasTexture" id="AtlasTexture_0fy8c"] +atlas = ExtResource("1_uk30u") +region = Rect2(0, 0, 640, 320) + +[sub_resource type="AtlasTexture" id="AtlasTexture_xvvmv"] +atlas = ExtResource("1_uk30u") +region = Rect2(640, 0, 640, 320) + +[sub_resource type="AtlasTexture" id="AtlasTexture_byc1j"] +atlas = ExtResource("1_uk30u") +region = Rect2(1280, 0, 640, 320) + +[sub_resource type="AtlasTexture" id="AtlasTexture_y3keh"] +atlas = ExtResource("1_uk30u") +region = Rect2(0, 320, 640, 320) + +[sub_resource type="AtlasTexture" id="AtlasTexture_jn0gr"] +atlas = ExtResource("1_uk30u") +region = Rect2(640, 320, 640, 320) + +[sub_resource type="AtlasTexture" id="AtlasTexture_yg5i2"] +atlas = ExtResource("1_uk30u") +region = Rect2(1280, 320, 640, 320) + +[sub_resource type="AtlasTexture" id="AtlasTexture_u5ugd"] +atlas = ExtResource("1_uk30u") +region = Rect2(0, 640, 640, 320) + +[sub_resource type="SpriteFrames" id="SpriteFrames_uwnlw"] +animations = [{ +"frames": [{ +"duration": 1.0, +"texture": SubResource("AtlasTexture_0fy8c") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_xvvmv") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_byc1j") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_y3keh") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_jn0gr") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_yg5i2") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_u5ugd") +}], +"loop": true, +"name": &"stars", +"speed": 5.0 +}] + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_3myi4"] +size = Vector2(138, 151) + +[sub_resource type="CircleShape2D" id="CircleShape2D_agvig"] +radius = 31.0 + +[sub_resource type="CircleShape2D" id="CircleShape2D_wofwh"] +radius = 36.0555 + +[sub_resource type="CircleShape2D" id="CircleShape2D_3rrcl"] +radius = 41.3038 + +[sub_resource type="CircleShape2D" id="CircleShape2D_eo4rb"] +radius = 35.5106 + +[sub_resource type="CircleShape2D" id="CircleShape2D_ohvj2"] +radius = 39.4588 + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_wmj16"] +size = Vector2(42, 648) + +[node name="Node2D" type="Node2D"] + +[node name="Starry background" type="AnimatedSprite2D" parent="."] +position = Vector2(576, 324.5) +scale = Vector2(1.8, 2.02188) +sprite_frames = SubResource("SpriteFrames_uwnlw") +animation = &"stars" +frame = 6 +script = ExtResource("2_6xdch") + +[node name="Background" type="AudioStreamPlayer" parent="Starry background"] +stream = ExtResource("3_0g6qg") +autoplay = true + +[node name="Player" type="CharacterBody2D" parent="." groups=["player"]] +script = ExtResource("4_n20oe") + +[node name="CollisionShape2D" type="CollisionShape2D" parent="Player"] +position = Vector2(1003, 509.5) +shape = SubResource("RectangleShape2D_3myi4") + +[node name="Sprite2D" type="Sprite2D" parent="Player"] +position = Vector2(1003, 509.476) +scale = Vector2(0.460317, 0.460317) +texture = ExtResource("5_hgogw") + +[node name="Clue1" type="Area2D" parent="."] +position = Vector2(198, 31) +script = ExtResource("6_8v7fc") + +[node name="CollisionShape2D" type="CollisionShape2D" parent="Clue1"] +position = Vector2(37, 40) +shape = SubResource("CircleShape2D_agvig") + +[node name="Sun" type="Sprite2D" parent="Clue1"] +position = Vector2(139, 40) +texture = ExtResource("7_08fvd") + +[node name="Clue2" type="Area2D" parent="."] +position = Vector2(549, 75) +script = ExtResource("8_i7dl7") + +[node name="CollisionShape2D" type="CollisionShape2D" parent="Clue2"] +position = Vector2(54, 18) +shape = SubResource("CircleShape2D_wofwh") + +[node name="Label" type="Label" parent="Clue2"] +offset_left = 94.0 +offset_top = 5.0 +offset_right = 134.0 +offset_bottom = 28.0 + +[node name="Clue3" type="Area2D" parent="."] +position = Vector2(296, 468) +script = ExtResource("9_c5eqc") + +[node name="CollisionShape2D" type="CollisionShape2D" parent="Clue3"] +position = Vector2(44, 44) +shape = SubResource("CircleShape2D_3rrcl") + +[node name="Label" type="Label" parent="Clue3"] +offset_right = 40.0 +offset_bottom = 23.0 + +[node name="Clue4" type="Area2D" parent="."] +position = Vector2(718, 461) +script = ExtResource("10_wpwbu") + +[node name="CollisionShape2D" type="CollisionShape2D" parent="Clue4"] +position = Vector2(55, 38) +shape = SubResource("CircleShape2D_eo4rb") + +[node name="Label" type="Label" parent="Clue4"] +offset_right = 40.0 +offset_bottom = 23.0 + +[node name="Clue5" type="Area2D" parent="."] +position = Vector2(945, 57) +script = ExtResource("11_rlvsd") + +[node name="CollisionShape2D" type="CollisionShape2D" parent="Clue5"] +position = Vector2(46, 23) +shape = SubResource("CircleShape2D_ohvj2") + +[node name="Label" type="Label" parent="Clue5"] +offset_left = -37.0 +offset_top = 72.0 +offset_right = 3.0 +offset_bottom = 95.0 + +[node name="answer" type="Area2D" parent="."] +position = Vector2(37, 240) +script = ExtResource("12_o6d3n") + +[node name="CollisionShape2D" type="CollisionShape2D" parent="answer"] +position = Vector2(-16, 84) +shape = SubResource("RectangleShape2D_wmj16") + +[node name="Panel" type="Panel" parent="answer"] +offset_left = 42.0 +offset_top = -221.0 +offset_right = 1039.0 +offset_bottom = 396.0 + +[node name="Label" type="Label" parent="answer/Panel"] +layout_mode = 0 +offset_left = 220.0 +offset_top = 27.0 +offset_right = 789.0 +offset_bottom = 125.0 +horizontal_alignment = 1 +vertical_alignment = 1 + +[node name="Body" type="Label" parent="answer/Panel"] +layout_mode = 0 +offset_left = 14.0 +offset_top = 132.0 +offset_right = 981.0 +offset_bottom = 417.0 +horizontal_alignment = 1 +vertical_alignment = 1 + +[node name="Ans1" type="Button" parent="answer/Panel"] +layout_mode = 0 +offset_left = 524.0 +offset_top = 544.0 +offset_right = 747.0 +offset_bottom = 602.0 +text = "Polaris" + +[node name="Ans2" type="Button" parent="answer/Panel"] +layout_mode = 0 +offset_left = 230.0 +offset_top = 542.0 +offset_right = 453.0 +offset_bottom = 600.0 +text = "Andromeda" + +[node name="Ans3" type="Button" parent="answer/Panel"] +layout_mode = 0 +offset_left = 521.0 +offset_top = 456.0 +offset_right = 744.0 +offset_bottom = 514.0 +text = "Cancer" + +[node name="Ans4" type="Button" parent="answer/Panel"] +layout_mode = 0 +offset_left = 233.0 +offset_top = 456.0 +offset_right = 456.0 +offset_bottom = 514.0 +text = "Cassiopeia" + +[node name="Return" type="Button" parent="answer/Panel"] +layout_mode = 0 +offset_left = 416.0 +offset_top = 330.0 +offset_right = 562.0 +offset_bottom = 416.0 +text = "Return to cockpit!" + +[connection signal="finished" from="Starry background/Background" to="Starry background" method="_on_background_finished"] +[connection signal="body_entered" from="Clue1" to="Clue1" method="_on_body_entered"] +[connection signal="body_exited" from="Clue1" to="Clue1" method="_on_body_exited"] +[connection signal="body_entered" from="Clue2" to="Clue2" method="_on_body_entered"] +[connection signal="body_exited" from="Clue2" to="Clue2" method="_on_body_exited"] +[connection signal="body_entered" from="Clue3" to="Clue3" method="_on_body_entered"] +[connection signal="body_exited" from="Clue3" to="Clue3" method="_on_body_exited"] +[connection signal="body_entered" from="Clue4" to="Clue4" method="_on_body_entered"] +[connection signal="body_exited" from="Clue4" to="Clue4" method="_on_body_exited"] +[connection signal="body_entered" from="Clue5" to="Clue5" method="_on_body_entered"] +[connection signal="body_exited" from="Clue5" to="Clue5" method="_on_body_exited"] +[connection signal="body_entered" from="answer" to="answer" method="_on_body_entered"] +[connection signal="body_exited" from="answer" to="answer" method="_on_body_exited"] +[connection signal="pressed" from="answer/Panel/Ans1" to="answer" method="_on_ans_1_pressed"] +[connection signal="pressed" from="answer/Panel/Ans2" to="answer" method="_on_ans_2_pressed"] +[connection signal="pressed" from="answer/Panel/Ans3" to="answer" method="_on_ans_3_pressed"] +[connection signal="pressed" from="answer/Panel/Ans4" to="Starry background" method="_on_ans_4_pressed"] +[connection signal="pressed" from="answer/Panel/Ans4" to="answer" method="_on_ans_4_pressed"] +[connection signal="pressed" from="answer/Panel/Return" to="answer" method="_on_return_pressed"] diff --git a/scenes/start_button.tscn b/scenes/start_button.tscn index e2dbe85..65231a6 100644 --- a/scenes/start_button.tscn +++ b/scenes/start_button.tscn @@ -35,3 +35,5 @@ offset_bottom = 133.0 action_mode = 0 texture_normal = ExtResource("1_u3ucj") texture_pressed = ExtResource("2_32y8s") + +[connection signal="finished" from="AudioStreamPlayer" to="." method="_on_audio_stream_player_finished"] diff --git a/scripts/Stage1/Clue1.gd b/scripts/Stage1/Clue1.gd index e08a0fa..ec1c43f 100644 --- a/scripts/Stage1/Clue1.gd +++ b/scripts/Stage1/Clue1.gd @@ -3,7 +3,6 @@ extends Area2D @onready var hint = $Sun func _ready(): - hint.text = "It's the closest star to the Sun!" hint.visible = false # Showing text when the player enters the area diff --git a/scripts/Stage1/Clue2.gd b/scripts/Stage1/Clue2.gd index d0af680..252d18d 100644 --- a/scripts/Stage1/Clue2.gd +++ b/scripts/Stage1/Clue2.gd @@ -3,7 +3,7 @@ extends Area2D @onready var label = $Label func _ready(): - label.text = "It's the closest star to the Sun!" + label.text = "It's the star closest to Earth!" label.visible_characters = 0 # Showing text when the player enters the area diff --git a/scripts/Stage1/Clue3.gd b/scripts/Stage1/Clue3.gd index 38d5f42..e917018 100644 --- a/scripts/Stage1/Clue3.gd +++ b/scripts/Stage1/Clue3.gd @@ -3,7 +3,7 @@ extends Area2D @onready var label = $Label func _ready(): - label.text = "It's the closest star to the Sun!" + label.text = "It's a giant gas ball!" label.visible_characters = 0 # Showing text when the player enters the area diff --git a/scripts/Stage1/Clue4.gd b/scripts/Stage1/Clue4.gd index 38d5f42..ee17f3d 100644 --- a/scripts/Stage1/Clue4.gd +++ b/scripts/Stage1/Clue4.gd @@ -3,7 +3,7 @@ extends Area2D @onready var label = $Label func _ready(): - label.text = "It's the closest star to the Sun!" + label.text = "The Moon reflects its light sometimes!" label.visible_characters = 0 # Showing text when the player enters the area diff --git a/scripts/Stage1/Clue5.gd b/scripts/Stage1/Clue5.gd index 38d5f42..d35e1db 100644 --- a/scripts/Stage1/Clue5.gd +++ b/scripts/Stage1/Clue5.gd @@ -3,7 +3,7 @@ extends Area2D @onready var label = $Label func _ready(): - label.text = "It's the closest star to the Sun!" + label.text = "The entire Milky Way revolves around this!" label.visible_characters = 0 # Showing text when the player enters the area diff --git a/scripts/Stage2/AnswerGUI.gd b/scripts/Stage2/AnswerGUI.gd new file mode 100644 index 0000000..b904cbb --- /dev/null +++ b/scripts/Stage2/AnswerGUI.gd @@ -0,0 +1,66 @@ +extends Area2D + +@onready var panel = $Panel +@onready var heading = $Panel/Label +@onready var middle = $Panel/Body +@onready var Ans1 = $Panel/Ans1 +@onready var Ans2 = $Panel/Ans2 +@onready var Ans3 = $Panel/Ans3 +@onready var Ans4 = $Panel/Ans4 +@onready var cockpit_button = $Panel/Return + +func _ready(): + heading.text = "QUIZ!" + middle.text = "Which star are you on?" + panel.visible = false + heading.visible_characters = 0 + middle.visible_characters = 0 + Ans1.visible = false + Ans2.visible = false + Ans3.visible = false + Ans4.visible = false + cockpit_button.visible = false + +# Showing text when the player enters the area +func _on_body_entered(body): + if body.is_in_group("player"): # The player-character is in a group called "player" + panel.visible = true + heading.visible_characters = -1 + middle.visible_characters = -1 + Ans1.visible = true + Ans2.visible = true + Ans3.visible = true + Ans4.visible = true + +# Hiding text when the player exits the area +func _on_body_exited(body): + if body.is_in_group("player"): + panel.visible = false + heading.visible_characters = 0 + middle.visible_characters = 0 + Ans1.visible = false + Ans2.visible = false + Ans3.visible = false + Ans4.visible = false + +func _on_ans_1_pressed(): + middle.text = "Correct!" + heading.visible_characters = 0 + Ans1.visible = false + Ans2.visible = false + Ans3.visible = false + Ans4.visible = false + cockpit_button.visible = true + +func _on_ans_4_pressed(): + middle.text = "Incorrect!" + +func _on_ans_2_pressed(): + middle.text = "Incorrect!" + +func _on_ans_3_pressed(): + middle.text = "Incorrect!" + + +func _on_return_pressed(): + get_tree().change_scene_to_file("res://scenes/cockpit.tscn") diff --git a/scripts/Stage2/Clue1.gd b/scripts/Stage2/Clue1.gd new file mode 100644 index 0000000..e08a0fa --- /dev/null +++ b/scripts/Stage2/Clue1.gd @@ -0,0 +1,17 @@ +extends Area2D + +@onready var hint = $Sun + +func _ready(): + hint.text = "It's the closest star to the Sun!" + hint.visible = false + +# Showing text when the player enters the area +func _on_body_entered(body): + if body.is_in_group("player"): # The player-character is in a group called "player" + hint.visible = true + +# Hiding text when the player exits the area +func _on_body_exited(body): + if body.is_in_group("player"): + hint.visible = false diff --git a/scripts/Stage2/Clue2.gd b/scripts/Stage2/Clue2.gd new file mode 100644 index 0000000..d0af680 --- /dev/null +++ b/scripts/Stage2/Clue2.gd @@ -0,0 +1,17 @@ +extends Area2D + +@onready var label = $Label + +func _ready(): + label.text = "It's the closest star to the Sun!" + label.visible_characters = 0 + +# Showing text when the player enters the area +func _on_body_entered(body): + if body.is_in_group("player"): # The player-character is in a group called "player" + label.visible_characters = -1 + +# Hiding text when the player exits the area +func _on_body_exited(body): + if body.is_in_group("player"): + label.visible_characters = 0 diff --git a/scripts/Stage2/Clue3.gd b/scripts/Stage2/Clue3.gd new file mode 100644 index 0000000..38d5f42 --- /dev/null +++ b/scripts/Stage2/Clue3.gd @@ -0,0 +1,17 @@ +extends Area2D + +@onready var label = $Label + +func _ready(): + label.text = "It's the closest star to the Sun!" + label.visible_characters = 0 + +# Showing text when the player enters the area +func _on_body_entered(body): + if body.is_in_group("player"): # The player-character is in a group called "player" + label.visible_characters = -1 + +# Hiding text when the player exits the area +func _on_body_exited(body): + if body.is_in_group("player"): + label.visible_characters = 0 diff --git a/scripts/Stage2/Clue4.gd b/scripts/Stage2/Clue4.gd new file mode 100644 index 0000000..38d5f42 --- /dev/null +++ b/scripts/Stage2/Clue4.gd @@ -0,0 +1,17 @@ +extends Area2D + +@onready var label = $Label + +func _ready(): + label.text = "It's the closest star to the Sun!" + label.visible_characters = 0 + +# Showing text when the player enters the area +func _on_body_entered(body): + if body.is_in_group("player"): # The player-character is in a group called "player" + label.visible_characters = -1 + +# Hiding text when the player exits the area +func _on_body_exited(body): + if body.is_in_group("player"): + label.visible_characters = 0 diff --git a/scripts/Stage2/Clue5.gd b/scripts/Stage2/Clue5.gd new file mode 100644 index 0000000..38d5f42 --- /dev/null +++ b/scripts/Stage2/Clue5.gd @@ -0,0 +1,17 @@ +extends Area2D + +@onready var label = $Label + +func _ready(): + label.text = "It's the closest star to the Sun!" + label.visible_characters = 0 + +# Showing text when the player enters the area +func _on_body_entered(body): + if body.is_in_group("player"): # The player-character is in a group called "player" + label.visible_characters = -1 + +# Hiding text when the player exits the area +func _on_body_exited(body): + if body.is_in_group("player"): + label.visible_characters = 0 diff --git a/scripts/Starry background.gd b/scripts/Starry background.gd index 44e45d8..ee284ea 100644 --- a/scripts/Starry background.gd +++ b/scripts/Starry background.gd @@ -13,3 +13,6 @@ func _process(delta): func _on_ans_4_pressed(): audio_player.stop() + +func _on_background_finished(): + audio_player.play() diff --git a/scripts/cockpit.gd b/scripts/cockpit.gd new file mode 100644 index 0000000..1adc174 --- /dev/null +++ b/scripts/cockpit.gd @@ -0,0 +1,20 @@ +extends Node2D + +@onready var sun = $Sun +@onready var polaris = $Polaris +@onready var proxima = $Proxima_centauri + +# Called when the node enters the scene tree for the first time. +func _ready(): + if sun: + sun.connect("button_up", Callable(self, "_on_sun_button_pressed")) + elif polaris: + polaris.connect("button_up", Callable(self, "_on_polaris_button_pressed")) + else: + print("Sun button not found.") + +func _on_sun_button_pressed(): + get_tree().change_scene_to_file("res://scenes/stages/stage1.tscn") + +func _on_polaris_button_pressed(): + get_tree().change_scene_to_file("res://scenes/stages/stage2.tscn") diff --git a/scripts/scene_transition.gd b/scripts/scene_transition.gd index bbfa32f..ac1f87c 100644 --- a/scripts/scene_transition.gd +++ b/scripts/scene_transition.gd @@ -17,4 +17,7 @@ func _on_button_pressed(): # Debug line print("Button pressed, stopping music and changing scenes!") audio_player.stop() - get_tree().change_scene_to_file("res://scenes/stages/stage1.tscn") + get_tree().change_scene_to_file("res://scenes/cockpit.tscn") + +func _on_audio_stream_player_finished(): + audio_player.play()