Adding end screen/condition and updating credits
Signed-off-by: Ethan Wellenreiter <ewellenreiter@gmail.com>
This commit is contained in:
parent
0132088cae
commit
ef61882eab
10
ui/credits/credits.gd
Normal file
10
ui/credits/credits.gd
Normal file
@ -0,0 +1,10 @@
|
||||
extends Control
|
||||
|
||||
#@onready var play: Button = %Play
|
||||
#@onready var options: Button = %Options
|
||||
#@onready var credits: Button = %Credits
|
||||
@onready var quit: Button = %Quit
|
||||
|
||||
|
||||
func _on_quit_pressed() -> void:
|
||||
get_tree().quit()
|
||||
@ -1,3 +1,51 @@
|
||||
[gd_scene format=3 uid="uid://c6pcfriyav1bi"]
|
||||
[gd_scene load_steps=3 format=3 uid="uid://c6pcfriyav1bi"]
|
||||
|
||||
[node name="Credits" type="Node2D"]
|
||||
[ext_resource type="Script" path="res://ui/credits/credits.gd" id="1_g50xm"]
|
||||
[ext_resource type="Texture2D" uid="uid://b48bhtfvrv7rc" path="res://assets/background.png" id="2_2fctk"]
|
||||
|
||||
[node name="Control" type="Control"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 0
|
||||
offset_right = 40.0
|
||||
offset_bottom = 40.0
|
||||
script = ExtResource("1_g50xm")
|
||||
|
||||
[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_2fctk")
|
||||
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 = "Credits
|
||||
Ethan Wellenreiter"
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="Quit" type="Button" parent="CenterContainer/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "Quit"
|
||||
|
||||
[connection signal="pressed" from="CenterContainer/VBoxContainer/Quit" to="." method="_on_quit_pressed"]
|
||||
|
||||
33
ui/end_screen/end_screen.gd
Normal file
33
ui/end_screen/end_screen.gd
Normal 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()
|
||||
63
ui/end_screen/end_screen.tscn
Normal file
63
ui/end_screen/end_screen.tscn
Normal file
@ -0,0 +1,63 @@
|
||||
[gd_scene load_steps=3 format=3 uid="uid://cbmoctho8rxye"]
|
||||
|
||||
[ext_resource type="Script" path="res://ui/end_screen/end_screen.gd" id="1_3ta7n"]
|
||||
[ext_resource type="Texture2D" uid="uid://b48bhtfvrv7rc" path="res://assets/background.png" id="2_53wde"]
|
||||
|
||||
[node name="Control" type="Control"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 0
|
||||
offset_right = 40.0
|
||||
offset_bottom = 40.0
|
||||
script = ExtResource("1_3ta7n")
|
||||
|
||||
[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_53wde")
|
||||
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 = "Congrats. You've now finished -
|
||||
What's below"
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="Play" type="Button" parent="CenterContainer/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "Replay"
|
||||
|
||||
[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"]
|
||||
@ -1,6 +1,7 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://jy7jx2xayf14"]
|
||||
[gd_scene load_steps=3 format=3 uid="uid://jy7jx2xayf14"]
|
||||
|
||||
[ext_resource type="Script" path="res://ui/main menu/main_menu.gd" id="1_226f7"]
|
||||
[ext_resource type="Texture2D" uid="uid://b48bhtfvrv7rc" path="res://assets/background.png" id="2_jqujp"]
|
||||
|
||||
[node name="MainMenu" type="Control"]
|
||||
layout_mode = 3
|
||||
@ -13,6 +14,16 @@ size_flags_horizontal = 4
|
||||
size_flags_vertical = 4
|
||||
script = ExtResource("1_226f7")
|
||||
|
||||
[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_jqujp")
|
||||
stretch_mode = 1
|
||||
|
||||
[node name="CenterContainer" type="CenterContainer" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
@ -29,6 +40,7 @@ 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 = "What's below"
|
||||
horizontal_alignment = 1
|
||||
|
||||
@ -6,6 +6,7 @@ extends Node2D
|
||||
|
||||
@onready var level_one = load("res://world/world_level/level.tscn")
|
||||
@onready var credits = load("res://ui/credits/credits.tscn")
|
||||
@onready var end_screen = load("res://ui/end_screen/end_screen.tscn")
|
||||
|
||||
@onready var current_level = -1
|
||||
@onready var current_scene: Node
|
||||
@ -38,6 +39,9 @@ func switch_scene(sceneNo: int):
|
||||
3:
|
||||
current_level = 3
|
||||
get_tree().change_scene_to_packed(credits)
|
||||
4:
|
||||
current_level = 4
|
||||
get_tree().change_scene_to_packed(end_screen)
|
||||
|
||||
#func start_timer(seconds: float):
|
||||
#timer_component.start(seconds)
|
||||
|
||||
16
world/world_level/area_2d.gd
Normal file
16
world/world_level/area_2d.gd
Normal file
@ -0,0 +1,16 @@
|
||||
extends Area2D
|
||||
|
||||
|
||||
# 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_body_entered(body: Node2D) -> void:
|
||||
if body is Player:
|
||||
Universe.switch_scene(4)
|
||||
@ -1,8 +1,9 @@
|
||||
[gd_scene load_steps=9 format=3 uid="uid://dojvn2guqhhel"]
|
||||
[gd_scene load_steps=11 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"]
|
||||
[ext_resource type="Texture2D" uid="uid://d0oq3rgb204fl" path="res://assets/ground.png" id="3_rvbjd"]
|
||||
[ext_resource type="Script" path="res://world/world_level/area_2d.gd" id="4_nedwe"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_ptfhu"]
|
||||
size = Vector2(1980, 26)
|
||||
@ -19,6 +20,9 @@ size = Vector2(1974, 298.559)
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_d8lc8"]
|
||||
size = Vector2(243.5, 11.0001)
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_kwtnh"]
|
||||
size = Vector2(921, 674)
|
||||
|
||||
[node name="Level" type="Node2D"]
|
||||
|
||||
[node name="Background" type="TextureRect" parent="."]
|
||||
@ -98,3 +102,13 @@ shape = SubResource("RectangleShape2D_d8lc8")
|
||||
position = Vector2(137.479, 875.059)
|
||||
scale = Vector2(0.122864, 1)
|
||||
texture = ExtResource("3_rvbjd")
|
||||
|
||||
[node name="Area2D" type="Area2D" parent="."]
|
||||
collision_layer = 32768
|
||||
script = ExtResource("4_nedwe")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
|
||||
position = Vector2(-2272, -117)
|
||||
shape = SubResource("RectangleShape2D_kwtnh")
|
||||
|
||||
[connection signal="body_entered" from="Area2D" to="Area2D" method="_on_body_entered"]
|
||||
|
||||
Loading…
Reference in New Issue
Block a user