Add FinalMenu and tweak signals
Signals are not correctly connected yet. I need to extract the Player from the Level scene.
This commit is contained in:
parent
acacbc65e8
commit
3aeeaab1ba
9 changed files with 130 additions and 23 deletions
9
scenes/FinalMenu.gd
Normal file
9
scenes/FinalMenu.gd
Normal file
|
@ -0,0 +1,9 @@
|
|||
extends Control
|
||||
|
||||
signal retried
|
||||
|
||||
func _on_TryAgain_pressed():
|
||||
emit_signal("retried")
|
||||
|
||||
func _on_Exit_pressed():
|
||||
get_tree().quit()
|
62
scenes/FinalMenu.tscn
Normal file
62
scenes/FinalMenu.tscn
Normal file
|
@ -0,0 +1,62 @@
|
|||
[gd_scene load_steps=5 format=2]
|
||||
|
||||
[ext_resource path="res://scenes/FinalMenu.gd" type="Script" id=1]
|
||||
[ext_resource path="res://fonts/Montserrat-ExtraBold.otf" type="DynamicFontData" id=2]
|
||||
[ext_resource path="res://fonts/montserrat_eb_32.tres" type="DynamicFont" id=3]
|
||||
|
||||
[sub_resource type="DynamicFont" id=1]
|
||||
|
||||
size = 48
|
||||
font_data = ExtResource( 2 )
|
||||
|
||||
[node name="FinalMenu" type="Control"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="CenterContainer" type="CenterContainer" parent="."]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
|
||||
[node name="Column" type="VBoxContainer" parent="CenterContainer"]
|
||||
margin_left = 329.0
|
||||
margin_top = 223.0
|
||||
margin_right = 695.0
|
||||
margin_bottom = 377.0
|
||||
|
||||
[node name="Title" type="Label" parent="CenterContainer/Column"]
|
||||
margin_right = 366.0
|
||||
margin_bottom = 60.0
|
||||
custom_fonts/font = SubResource( 1 )
|
||||
text = "Success!"
|
||||
align = 1
|
||||
|
||||
[node name="Label" type="Label" parent="CenterContainer/Column"]
|
||||
margin_top = 64.0
|
||||
margin_right = 366.0
|
||||
margin_bottom = 104.0
|
||||
custom_fonts/font = ExtResource( 3 )
|
||||
text = "You finished Level 01."
|
||||
|
||||
[node name="Row" type="HBoxContainer" parent="CenterContainer/Column"]
|
||||
margin_top = 108.0
|
||||
margin_right = 366.0
|
||||
margin_bottom = 154.0
|
||||
|
||||
[node name="TryAgain" type="Button" parent="CenterContainer/Column/Row"]
|
||||
margin_right = 181.0
|
||||
margin_bottom = 46.0
|
||||
size_flags_horizontal = 3
|
||||
custom_fonts/font = ExtResource( 3 )
|
||||
text = "Try again"
|
||||
|
||||
[node name="Exit" type="Button" parent="CenterContainer/Column/Row"]
|
||||
margin_left = 185.0
|
||||
margin_right = 366.0
|
||||
margin_bottom = 46.0
|
||||
size_flags_horizontal = 3
|
||||
custom_fonts/font = ExtResource( 3 )
|
||||
text = "Exit"
|
||||
|
||||
[connection signal="pressed" from="CenterContainer/Column/Row/TryAgain" to="." method="_on_TryAgain_pressed"]
|
||||
[connection signal="pressed" from="CenterContainer/Column/Row/Exit" to="." method="_on_Exit_pressed"]
|
|
@ -1,5 +1,7 @@
|
|||
extends Spatial
|
||||
|
||||
signal body_entered()
|
||||
|
||||
func _ready():
|
||||
get_node("Area").connect("body_entered", self, "collided")
|
||||
|
||||
|
@ -13,4 +15,7 @@ func collided(body):
|
|||
#func _process(delta):
|
||||
# var camera_pos = get_viewport().get_camera().global_transform.origin
|
||||
# camera_pos.y = 0
|
||||
# look_at(camera_pos, Vector3(0, 1, 0))
|
||||
# look_at(camera_pos, Vector3(0, 1, 0))
|
||||
|
||||
func _on_Area_body_entered(body):
|
||||
emit_signal("body_entered", body)
|
||||
|
|
|
@ -63,7 +63,7 @@ shader_param/PI = 3.1415
|
|||
gradient = SubResource( 4 )
|
||||
width = 2
|
||||
|
||||
[node name="Scene Root" index="0" instance=ExtResource( 1 )]
|
||||
[node name="Goal" instance=ExtResource( 1 )]
|
||||
script = ExtResource( 2 )
|
||||
|
||||
[node name="Pole" parent="." index="0"]
|
||||
|
@ -93,3 +93,4 @@ transform = Transform( 250, 0, 0, 0, 500, 0, 0, 0, 1, 0, 2.91655, 0 )
|
|||
material_override = SubResource( 3 )
|
||||
texture = SubResource( 5 )
|
||||
|
||||
[connection signal="body_entered" from="Area" to="." method="_on_Area_body_entered"]
|
||||
|
|
|
@ -39,10 +39,10 @@ func _physics_process(delta):
|
|||
velocity = move_and_slide(direction, floor_normal, 0.05, 4, deg2rad(MAX_SLOPE_ANGLE))
|
||||
|
||||
|
||||
func _process(delta):
|
||||
# Called every frame. Delta is time since last frame.
|
||||
# Update game logic here.
|
||||
pass
|
||||
#func _process(delta):
|
||||
# # Called every frame. Delta is time since last frame.
|
||||
# # Update game logic here.
|
||||
# pass
|
||||
|
||||
func reach_goal():
|
||||
has_reached_goal = true
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue