diff --git a/player/looking.gd b/player/looking.gd index 47c803d..a380272 100644 --- a/player/looking.gd +++ b/player/looking.gd @@ -44,7 +44,7 @@ func _process(delta: float) -> void: elif player.on_rope: - print("was_on_rope") + #print("was_on_rope") player.on_rope = false player.connection_point = Vector2.ZERO player.rope.clear_rope() diff --git a/player/player.gd b/player/player.gd index 8b09350..53b827f 100644 --- a/player/player.gd +++ b/player/player.gd @@ -32,8 +32,7 @@ var on_rope : bool = false func _process(delta: float) -> void: if Input.is_action_just_pressed("restart"): Universe.switch_scene(2) - elif Input.is_action_just_pressed("escape"): - Universe.switch_scene(1) + func add_gravity(delta: float) -> void: velocity += get_gravity() * delta diff --git a/ui/credits/credits.gd b/ui/credits/credits.gd index b449763..59afe29 100644 --- a/ui/credits/credits.gd +++ b/ui/credits/credits.gd @@ -8,3 +8,7 @@ extends Control func _on_quit_pressed() -> void: get_tree().quit() + + +func _on_main_menu_pressed() -> void: + Universe.switch_scene(1) diff --git a/ui/credits/credits.tscn b/ui/credits/credits.tscn index 3365e38..e7c4b65 100644 --- a/ui/credits/credits.tscn +++ b/ui/credits/credits.tscn @@ -43,9 +43,15 @@ text = "Credits Ethan Wellenreiter" horizontal_alignment = 1 +[node name="Main Menu" type="Button" parent="CenterContainer/VBoxContainer"] +unique_name_in_owner = true +layout_mode = 2 +text = "Main Menu" + [node name="Quit" type="Button" parent="CenterContainer/VBoxContainer"] unique_name_in_owner = true layout_mode = 2 text = "Quit" +[connection signal="pressed" from="CenterContainer/VBoxContainer/Main Menu" to="." method="_on_main_menu_pressed"] [connection signal="pressed" from="CenterContainer/VBoxContainer/Quit" to="." method="_on_quit_pressed"] diff --git a/ui/end_screen/end_screen.gd b/ui/end_screen/end_screen.gd index e8db70d..75d3d7b 100644 --- a/ui/end_screen/end_screen.gd +++ b/ui/end_screen/end_screen.gd @@ -17,7 +17,7 @@ func _process(delta: float) -> void: func _on_play_pressed() -> void: #await get_tree().create_timer(20).timeout - print("Pressed play") + #print("Pressed play") Universe.switch_scene(2) diff --git a/ui/instructions/instructions.gd b/ui/instructions/instructions.gd new file mode 100644 index 0000000..75d3d7b --- /dev/null +++ b/ui/instructions/instructions.gd @@ -0,0 +1,33 @@ +extends Control + +@onready var play: Button = %Play +#@onready var options: Button = %Options +@onready var credits: Button = %Credits +@onready var quit: Button = %Quit + +# Called when the node enters the scene tree for the first time. +func _ready() -> void: + pass # Replace with function body. + + +# Called every frame. 'delta' is the elapsed time since the previous frame. +func _process(delta: float) -> void: + pass + + +func _on_play_pressed() -> void: + #await get_tree().create_timer(20).timeout + #print("Pressed play") + Universe.switch_scene(2) + + +#func _on_options_pressed() -> void: + #pass # Replace with function body. +# +# +func _on_credits_pressed() -> void: + Universe.switch_scene(3) + + +func _on_quit_pressed() -> void: + get_tree().quit() diff --git a/ui/instructions/instructions.tscn b/ui/instructions/instructions.tscn new file mode 100644 index 0000000..8d43bda --- /dev/null +++ b/ui/instructions/instructions.tscn @@ -0,0 +1,68 @@ +[gd_scene load_steps=3 format=3 uid="uid://dnqlvhal4o1vv"] + +[ext_resource type="Script" path="res://ui/instructions/instructions.gd" id="1_ifbvd"] +[ext_resource type="Texture2D" uid="uid://b48bhtfvrv7rc" path="res://assets/background.png" id="2_oyhrc"] + +[node name="Control" type="Control"] +layout_mode = 3 +anchors_preset = 0 +offset_right = 40.0 +offset_bottom = 40.0 +script = ExtResource("1_ifbvd") + +[node name="Background" type="TextureRect" parent="."] +layout_mode = 0 +offset_left = -28284.0 +offset_top = -28611.0 +offset_right = 95490.0 +offset_bottom = 68437.0 +scale = Vector2(0.5, 0.5) +texture = ExtResource("2_oyhrc") +stretch_mode = 1 + +[node name="CenterContainer" type="CenterContainer" parent="."] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +offset_right = 1880.0 +offset_bottom = 1040.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="VBoxContainer" type="VBoxContainer" parent="CenterContainer"] +custom_minimum_size = Vector2(250, 200) +layout_mode = 2 +alignment = 1 + +[node name="Label" type="Label" parent="CenterContainer/VBoxContainer"] +layout_mode = 2 +theme_override_colors/font_color = Color(0, 0, 0, 1) +theme_override_font_sizes/font_size = 29 +text = "A/Left Arrow - Left +D/Right Arrow - Right +W/Spacebar/Up Arrow - Jump +R - Restart Level +Esc - Main Menu +Left Mouse Click - Aim and fire swinging rope +" +horizontal_alignment = 1 + +[node name="Play" type="Button" parent="CenterContainer/VBoxContainer"] +unique_name_in_owner = true +layout_mode = 2 +text = "Play" + +[node name="Credits" type="Button" parent="CenterContainer/VBoxContainer"] +unique_name_in_owner = true +layout_mode = 2 +text = "Credits" + +[node name="Quit" type="Button" parent="CenterContainer/VBoxContainer"] +unique_name_in_owner = true +layout_mode = 2 +text = "Quit" + +[connection signal="pressed" from="CenterContainer/VBoxContainer/Play" to="." method="_on_play_pressed"] +[connection signal="pressed" from="CenterContainer/VBoxContainer/Credits" to="." method="_on_credits_pressed"] +[connection signal="pressed" from="CenterContainer/VBoxContainer/Quit" to="." method="_on_quit_pressed"] diff --git a/ui/main menu/main_menu.gd b/ui/main menu/main_menu.gd index e8db70d..7b0e8fe 100644 --- a/ui/main menu/main_menu.gd +++ b/ui/main menu/main_menu.gd @@ -21,8 +21,8 @@ func _on_play_pressed() -> void: Universe.switch_scene(2) -#func _on_options_pressed() -> void: - #pass # Replace with function body. +func _on_instructions_pressed() -> void: + Universe.switch_scene(5) # # func _on_credits_pressed() -> void: diff --git a/ui/main menu/main_menu.tscn b/ui/main menu/main_menu.tscn index 54fbb0c..978391e 100644 --- a/ui/main menu/main_menu.tscn +++ b/ui/main menu/main_menu.tscn @@ -50,6 +50,11 @@ unique_name_in_owner = true layout_mode = 2 text = "Play" +[node name="Instructions" type="Button" parent="CenterContainer/VBoxContainer"] +unique_name_in_owner = true +layout_mode = 2 +text = "Instructions" + [node name="Credits" type="Button" parent="CenterContainer/VBoxContainer"] unique_name_in_owner = true layout_mode = 2 @@ -61,5 +66,6 @@ layout_mode = 2 text = "Quit" [connection signal="pressed" from="CenterContainer/VBoxContainer/Play" to="." method="_on_play_pressed"] +[connection signal="pressed" from="CenterContainer/VBoxContainer/Instructions" to="." method="_on_instructions_pressed"] [connection signal="pressed" from="CenterContainer/VBoxContainer/Credits" to="." method="_on_credits_pressed"] [connection signal="pressed" from="CenterContainer/VBoxContainer/Quit" to="." method="_on_quit_pressed"] diff --git a/world/universe/universe.gd b/world/universe/universe.gd index adcd0d3..c5e96ff 100644 --- a/world/universe/universe.gd +++ b/world/universe/universe.gd @@ -8,6 +8,8 @@ extends Node2D @onready var credits = load("res://ui/credits/credits.tscn") @onready var end_screen = load("res://ui/end_screen/end_screen.tscn") +@onready var instructions = load("res://ui/instructions/instructions.tscn") + @onready var current_level = -1 @onready var current_scene: Node @@ -23,7 +25,8 @@ func _process(delta: float) -> void: if (get_tree().current_scene != null): current_scene = get_tree().current_scene #print(get_tree().current_scene) - #pass + if Input.is_action_just_pressed("escape"): + Universe.switch_scene(1) func switch_scene(sceneNo: int): match sceneNo: @@ -42,6 +45,9 @@ func switch_scene(sceneNo: int): 4: current_level = 4 get_tree().change_scene_to_packed(end_screen) + 5: + current_level = 5 + get_tree().change_scene_to_packed(instructions) #func start_timer(seconds: float): #timer_component.start(seconds) diff --git a/world/world_level/level.tscn b/world/world_level/level.tscn index d3c720c..f7c2a29 100644 --- a/world/world_level/level.tscn +++ b/world/world_level/level.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=23 format=3 uid="uid://dojvn2guqhhel"] +[gd_scene load_steps=24 format=3 uid="uid://dojvn2guqhhel"] [ext_resource type="Texture2D" uid="uid://b48bhtfvrv7rc" path="res://assets/background.png" id="1_t0pgr"] [ext_resource type="PackedScene" uid="uid://brhc07imuholv" path="res://player/player.tscn" id="2_fpbhy"] @@ -45,6 +45,9 @@ size = Vector2(7, 2232) [sub_resource type="RectangleShape2D" id="RectangleShape2D_otqvd"] size = Vector2(465, 94) +[sub_resource type="RectangleShape2D" id="RectangleShape2D_7aarp"] +size = Vector2(145, 111) + [sub_resource type="RectangleShape2D" id="RectangleShape2D_toy5f"] size = Vector2(63, 52) @@ -178,8 +181,9 @@ shape = SubResource("RectangleShape2D_otqvd") [node name="StaticBody2D12" type="StaticBody2D" parent="Walls"] collision_layer = 2 -[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Walls/StaticBody2D12"] -polygon = PackedVector2Array(-1275, 621, -1265, 522, -1397, 510, -1412, 622) +[node name="CollisionShape2D" type="CollisionShape2D" parent="Walls/StaticBody2D12"] +position = Vector2(-1338.5, 565.5) +shape = SubResource("RectangleShape2D_7aarp") [node name="StaticBody2D15" type="StaticBody2D" parent="Walls"] collision_layer = 2