Cleaning up level

Signed-off-by: Ethan Wellenreiter <ewellenreiter@gmail.com>
This commit is contained in:
Ethan Wellenreiter 2025-01-05 01:38:13 -05:00
parent 8a6d4bd66d
commit 7e8ca4b590
11 changed files with 136 additions and 10 deletions

View File

@ -44,7 +44,7 @@ func _process(delta: float) -> void:
elif player.on_rope: elif player.on_rope:
print("was_on_rope") #print("was_on_rope")
player.on_rope = false player.on_rope = false
player.connection_point = Vector2.ZERO player.connection_point = Vector2.ZERO
player.rope.clear_rope() player.rope.clear_rope()

View File

@ -32,8 +32,7 @@ var on_rope : bool = false
func _process(delta: float) -> void: func _process(delta: float) -> void:
if Input.is_action_just_pressed("restart"): if Input.is_action_just_pressed("restart"):
Universe.switch_scene(2) Universe.switch_scene(2)
elif Input.is_action_just_pressed("escape"):
Universe.switch_scene(1)
func add_gravity(delta: float) -> void: func add_gravity(delta: float) -> void:
velocity += get_gravity() * delta velocity += get_gravity() * delta

View File

@ -8,3 +8,7 @@ extends Control
func _on_quit_pressed() -> void: func _on_quit_pressed() -> void:
get_tree().quit() get_tree().quit()
func _on_main_menu_pressed() -> void:
Universe.switch_scene(1)

View File

@ -43,9 +43,15 @@ text = "Credits
Ethan Wellenreiter" Ethan Wellenreiter"
horizontal_alignment = 1 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"] [node name="Quit" type="Button" parent="CenterContainer/VBoxContainer"]
unique_name_in_owner = true unique_name_in_owner = true
layout_mode = 2 layout_mode = 2
text = "Quit" 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"] [connection signal="pressed" from="CenterContainer/VBoxContainer/Quit" to="." method="_on_quit_pressed"]

View File

@ -17,7 +17,7 @@ func _process(delta: float) -> void:
func _on_play_pressed() -> void: func _on_play_pressed() -> void:
#await get_tree().create_timer(20).timeout #await get_tree().create_timer(20).timeout
print("Pressed play") #print("Pressed play")
Universe.switch_scene(2) Universe.switch_scene(2)

View File

@ -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()

View File

@ -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"]

View File

@ -21,8 +21,8 @@ func _on_play_pressed() -> void:
Universe.switch_scene(2) Universe.switch_scene(2)
#func _on_options_pressed() -> void: func _on_instructions_pressed() -> void:
#pass # Replace with function body. Universe.switch_scene(5)
# #
# #
func _on_credits_pressed() -> void: func _on_credits_pressed() -> void:

View File

@ -50,6 +50,11 @@ unique_name_in_owner = true
layout_mode = 2 layout_mode = 2
text = "Play" 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"] [node name="Credits" type="Button" parent="CenterContainer/VBoxContainer"]
unique_name_in_owner = true unique_name_in_owner = true
layout_mode = 2 layout_mode = 2
@ -61,5 +66,6 @@ layout_mode = 2
text = "Quit" text = "Quit"
[connection signal="pressed" from="CenterContainer/VBoxContainer/Play" to="." method="_on_play_pressed"] [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/Credits" to="." method="_on_credits_pressed"]
[connection signal="pressed" from="CenterContainer/VBoxContainer/Quit" to="." method="_on_quit_pressed"] [connection signal="pressed" from="CenterContainer/VBoxContainer/Quit" to="." method="_on_quit_pressed"]

View File

@ -8,6 +8,8 @@ extends Node2D
@onready var credits = load("res://ui/credits/credits.tscn") @onready var credits = load("res://ui/credits/credits.tscn")
@onready var end_screen = load("res://ui/end_screen/end_screen.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_level = -1
@onready var current_scene: Node @onready var current_scene: Node
@ -23,7 +25,8 @@ func _process(delta: float) -> void:
if (get_tree().current_scene != null): if (get_tree().current_scene != null):
current_scene = get_tree().current_scene current_scene = get_tree().current_scene
#print(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): func switch_scene(sceneNo: int):
match sceneNo: match sceneNo:
@ -42,6 +45,9 @@ func switch_scene(sceneNo: int):
4: 4:
current_level = 4 current_level = 4
get_tree().change_scene_to_packed(end_screen) get_tree().change_scene_to_packed(end_screen)
5:
current_level = 5
get_tree().change_scene_to_packed(instructions)
#func start_timer(seconds: float): #func start_timer(seconds: float):
#timer_component.start(seconds) #timer_component.start(seconds)

View File

@ -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="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"] [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"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_otqvd"]
size = Vector2(465, 94) size = Vector2(465, 94)
[sub_resource type="RectangleShape2D" id="RectangleShape2D_7aarp"]
size = Vector2(145, 111)
[sub_resource type="RectangleShape2D" id="RectangleShape2D_toy5f"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_toy5f"]
size = Vector2(63, 52) size = Vector2(63, 52)
@ -178,8 +181,9 @@ shape = SubResource("RectangleShape2D_otqvd")
[node name="StaticBody2D12" type="StaticBody2D" parent="Walls"] [node name="StaticBody2D12" type="StaticBody2D" parent="Walls"]
collision_layer = 2 collision_layer = 2
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Walls/StaticBody2D12"] [node name="CollisionShape2D" type="CollisionShape2D" parent="Walls/StaticBody2D12"]
polygon = PackedVector2Array(-1275, 621, -1265, 522, -1397, 510, -1412, 622) position = Vector2(-1338.5, 565.5)
shape = SubResource("RectangleShape2D_7aarp")
[node name="StaticBody2D15" type="StaticBody2D" parent="Walls"] [node name="StaticBody2D15" type="StaticBody2D" parent="Walls"]
collision_layer = 2 collision_layer = 2