ability to leave level select for main menu
This commit is contained in:
parent
470857ecfa
commit
ddafe49d12
2 changed files with 183 additions and 6 deletions
|
@ -1,4 +1,4 @@
|
||||||
extends Node
|
extends Control
|
||||||
|
|
||||||
export var travel_time: float = 1.0
|
export var travel_time: float = 1.0
|
||||||
|
|
||||||
|
@ -38,6 +38,7 @@ func _ready() -> void:
|
||||||
if target_level != null:
|
if target_level != null:
|
||||||
player_position.offset = target_level.offset
|
player_position.offset = target_level.offset
|
||||||
_select_level(selected_level)
|
_select_level(selected_level)
|
||||||
|
call_deferred("grab_focus")
|
||||||
|
|
||||||
#func _input(event: InputEvent) -> void:
|
#func _input(event: InputEvent) -> void:
|
||||||
# # load selected map
|
# # load selected map
|
||||||
|
@ -82,7 +83,9 @@ func _process(delta: float) -> void:
|
||||||
else:
|
else:
|
||||||
player_sprite.visible = true
|
player_sprite.visible = true
|
||||||
|
|
||||||
func _input(event: InputEvent) -> void:
|
func _gui_input(event: InputEvent) -> void:
|
||||||
|
if event.is_action_pressed("ui_cancel"):
|
||||||
|
animation_player.play("show_exit")
|
||||||
if not made_selection: # player is walking around
|
if not made_selection: # player is walking around
|
||||||
if event.is_action_pressed("ui_accept"):
|
if event.is_action_pressed("ui_accept"):
|
||||||
_update_stats()
|
_update_stats()
|
||||||
|
@ -184,3 +187,13 @@ func _update_stats() -> void:
|
||||||
selected_shard = 0
|
selected_shard = 0
|
||||||
shard_title.text = LevelData.levels[selected_level].shard_titles[selected_shard]
|
shard_title.text = LevelData.levels[selected_level].shard_titles[selected_shard]
|
||||||
shard_arrow.position.x = filled_shards.get_child(selected_shard).position.x
|
shard_arrow.position.x = filled_shards.get_child(selected_shard).position.x
|
||||||
|
|
||||||
|
|
||||||
|
func _on_StayHere_pressed() -> void:
|
||||||
|
animation_player.play("hide_exit")
|
||||||
|
|
||||||
|
|
||||||
|
func _on_ExitMenu_pressed() -> void:
|
||||||
|
Fade.fade_out(Options.transition_speed_secs)
|
||||||
|
yield(Fade, "fade_finished")
|
||||||
|
SceneManager.current_scene = load("res://menus/main_menu.tscn").instance()
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
[gd_scene load_steps=25 format=2]
|
[gd_scene load_steps=27 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://menus/level_select_scholar.gd" type="Script" id=1]
|
[ext_resource path="res://menus/level_select_scholar.gd" type="Script" id=1]
|
||||||
[ext_resource path="res://graphics/level_select/world_map.png" type="Texture" id=2]
|
[ext_resource path="res://graphics/level_select/world_map.png" type="Texture" id=2]
|
||||||
|
@ -77,6 +77,72 @@ tracks/1/keys = {
|
||||||
"update": 0,
|
"update": 0,
|
||||||
"values": [ Vector2( 1, 1 ) ]
|
"values": [ Vector2( 1, 1 ) ]
|
||||||
}
|
}
|
||||||
|
tracks/2/type = "value"
|
||||||
|
tracks/2/path = NodePath("ExitPopup:visible")
|
||||||
|
tracks/2/interp = 1
|
||||||
|
tracks/2/loop_wrap = true
|
||||||
|
tracks/2/imported = false
|
||||||
|
tracks/2/enabled = true
|
||||||
|
tracks/2/keys = {
|
||||||
|
"times": PoolRealArray( 0 ),
|
||||||
|
"transitions": PoolRealArray( 1 ),
|
||||||
|
"update": 0,
|
||||||
|
"values": [ false ]
|
||||||
|
}
|
||||||
|
tracks/3/type = "value"
|
||||||
|
tracks/3/path = NodePath("ExitPopup:rect_scale")
|
||||||
|
tracks/3/interp = 1
|
||||||
|
tracks/3/loop_wrap = true
|
||||||
|
tracks/3/imported = false
|
||||||
|
tracks/3/enabled = true
|
||||||
|
tracks/3/keys = {
|
||||||
|
"times": PoolRealArray( 0 ),
|
||||||
|
"transitions": PoolRealArray( 1 ),
|
||||||
|
"update": 0,
|
||||||
|
"values": [ Vector2( 1e-05, 0.011 ) ]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id=11]
|
||||||
|
resource_name = "hide_exit"
|
||||||
|
length = 0.4
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/path = NodePath("ExitPopup:visible")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PoolRealArray( 0.4 ),
|
||||||
|
"transitions": PoolRealArray( 1 ),
|
||||||
|
"update": 1,
|
||||||
|
"values": [ false ]
|
||||||
|
}
|
||||||
|
tracks/1/type = "value"
|
||||||
|
tracks/1/path = NodePath("ExitPopup:rect_scale")
|
||||||
|
tracks/1/interp = 1
|
||||||
|
tracks/1/loop_wrap = true
|
||||||
|
tracks/1/imported = false
|
||||||
|
tracks/1/enabled = true
|
||||||
|
tracks/1/keys = {
|
||||||
|
"times": PoolRealArray( 0, 0.2, 0.4 ),
|
||||||
|
"transitions": PoolRealArray( 1, 1, 1 ),
|
||||||
|
"update": 0,
|
||||||
|
"values": [ Vector2( 1, 1 ), Vector2( 1, 0.07 ), Vector2( 0, 0.07 ) ]
|
||||||
|
}
|
||||||
|
tracks/2/type = "method"
|
||||||
|
tracks/2/path = NodePath(".")
|
||||||
|
tracks/2/interp = 1
|
||||||
|
tracks/2/loop_wrap = true
|
||||||
|
tracks/2/imported = false
|
||||||
|
tracks/2/enabled = true
|
||||||
|
tracks/2/keys = {
|
||||||
|
"times": PoolRealArray( 0.4 ),
|
||||||
|
"transitions": PoolRealArray( 1 ),
|
||||||
|
"values": [ {
|
||||||
|
"args": [ ],
|
||||||
|
"method": "grab_focus"
|
||||||
|
} ]
|
||||||
|
}
|
||||||
|
|
||||||
[sub_resource type="Animation" id=8]
|
[sub_resource type="Animation" id=8]
|
||||||
resource_name = "hide_stats"
|
resource_name = "hide_stats"
|
||||||
|
@ -91,7 +157,7 @@ tracks/0/keys = {
|
||||||
"times": PoolRealArray( 0.4 ),
|
"times": PoolRealArray( 0.4 ),
|
||||||
"transitions": PoolRealArray( 1 ),
|
"transitions": PoolRealArray( 1 ),
|
||||||
"update": 1,
|
"update": 1,
|
||||||
"values": [ true ]
|
"values": [ false ]
|
||||||
}
|
}
|
||||||
tracks/1/type = "value"
|
tracks/1/type = "value"
|
||||||
tracks/1/path = NodePath("LevelStats:rect_scale")
|
tracks/1/path = NodePath("LevelStats:rect_scale")
|
||||||
|
@ -106,6 +172,48 @@ tracks/1/keys = {
|
||||||
"values": [ Vector2( 1, 1 ), Vector2( 1, 0.02 ), Vector2( 0, 0.02 ) ]
|
"values": [ Vector2( 1, 1 ), Vector2( 1, 0.02 ), Vector2( 0, 0.02 ) ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id=12]
|
||||||
|
resource_name = "show_exit"
|
||||||
|
length = 0.4
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/path = NodePath("ExitPopup:visible")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PoolRealArray( 0 ),
|
||||||
|
"transitions": PoolRealArray( 1 ),
|
||||||
|
"update": 1,
|
||||||
|
"values": [ true ]
|
||||||
|
}
|
||||||
|
tracks/1/type = "value"
|
||||||
|
tracks/1/path = NodePath("ExitPopup:rect_scale")
|
||||||
|
tracks/1/interp = 1
|
||||||
|
tracks/1/loop_wrap = true
|
||||||
|
tracks/1/imported = false
|
||||||
|
tracks/1/enabled = true
|
||||||
|
tracks/1/keys = {
|
||||||
|
"times": PoolRealArray( 0, 0.2, 0.4 ),
|
||||||
|
"transitions": PoolRealArray( 1, 1, 1 ),
|
||||||
|
"update": 0,
|
||||||
|
"values": [ Vector2( 0, 0.07 ), Vector2( 1, 0.07 ), Vector2( 1, 1 ) ]
|
||||||
|
}
|
||||||
|
tracks/2/type = "method"
|
||||||
|
tracks/2/path = NodePath("ExitPopup/PanelContainer/VBoxContainer/HBoxContainer/StayHere")
|
||||||
|
tracks/2/interp = 1
|
||||||
|
tracks/2/loop_wrap = true
|
||||||
|
tracks/2/imported = false
|
||||||
|
tracks/2/enabled = true
|
||||||
|
tracks/2/keys = {
|
||||||
|
"times": PoolRealArray( 0 ),
|
||||||
|
"transitions": PoolRealArray( 1 ),
|
||||||
|
"values": [ {
|
||||||
|
"args": [ ],
|
||||||
|
"method": "grab_focus"
|
||||||
|
} ]
|
||||||
|
}
|
||||||
|
|
||||||
[sub_resource type="Animation" id=7]
|
[sub_resource type="Animation" id=7]
|
||||||
resource_name = "show_stats"
|
resource_name = "show_stats"
|
||||||
length = 0.4
|
length = 0.4
|
||||||
|
@ -134,7 +242,10 @@ tracks/1/keys = {
|
||||||
"values": [ Vector2( 0, 0.02 ), Vector2( 1, 0.02 ), Vector2( 1, 1 ) ]
|
"values": [ Vector2( 0, 0.02 ), Vector2( 1, 0.02 ), Vector2( 1, 1 ) ]
|
||||||
}
|
}
|
||||||
|
|
||||||
[node name="LevelSelect" type="Node"]
|
[node name="LevelSelect" type="Control"]
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
focus_mode = 2
|
||||||
script = ExtResource( 1 )
|
script = ExtResource( 1 )
|
||||||
|
|
||||||
[node name="WorldMap" type="TextureRect" parent="."]
|
[node name="WorldMap" type="TextureRect" parent="."]
|
||||||
|
@ -229,7 +340,7 @@ offset = 217.0
|
||||||
|
|
||||||
[node name="rust" type="PathFollow2D" parent="LevelPath"]
|
[node name="rust" type="PathFollow2D" parent="LevelPath"]
|
||||||
position = Vector2( 177.983, 131.216 )
|
position = Vector2( 177.983, 131.216 )
|
||||||
rotation = 2.36487
|
rotation = 2.36506
|
||||||
offset = 258.0
|
offset = 258.0
|
||||||
|
|
||||||
[node name="lab" type="PathFollow2D" parent="LevelPath"]
|
[node name="lab" type="PathFollow2D" parent="LevelPath"]
|
||||||
|
@ -507,7 +618,9 @@ offset = Vector2( 5, 0 )
|
||||||
|
|
||||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||||
anims/RESET = SubResource( 6 )
|
anims/RESET = SubResource( 6 )
|
||||||
|
anims/hide_exit = SubResource( 11 )
|
||||||
anims/hide_stats = SubResource( 8 )
|
anims/hide_stats = SubResource( 8 )
|
||||||
|
anims/show_exit = SubResource( 12 )
|
||||||
anims/show_stats = SubResource( 7 )
|
anims/show_stats = SubResource( 7 )
|
||||||
|
|
||||||
[node name="ShardCount" type="Label" parent="."]
|
[node name="ShardCount" type="Label" parent="."]
|
||||||
|
@ -525,3 +638,54 @@ text = "72"
|
||||||
|
|
||||||
[node name="Shard" parent="." instance=ExtResource( 11 )]
|
[node name="Shard" parent="." instance=ExtResource( 11 )]
|
||||||
position = Vector2( 4, 5 )
|
position = Vector2( 4, 5 )
|
||||||
|
|
||||||
|
[node name="ExitPopup" type="CenterContainer" parent="."]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
visible = false
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
rect_scale = Vector2( 1e-05, 0.011 )
|
||||||
|
rect_pivot_offset = Vector2( 128, 96 )
|
||||||
|
theme = ExtResource( 4 )
|
||||||
|
|
||||||
|
[node name="PanelContainer" type="PanelContainer" parent="ExitPopup"]
|
||||||
|
margin_left = 125.0
|
||||||
|
margin_top = 93.0
|
||||||
|
margin_right = 131.0
|
||||||
|
margin_bottom = 99.0
|
||||||
|
|
||||||
|
[node name="VBoxContainer" type="VBoxContainer" parent="ExitPopup/PanelContainer"]
|
||||||
|
margin_left = 3.0
|
||||||
|
margin_top = 3.0
|
||||||
|
margin_right = 116.0
|
||||||
|
margin_bottom = 27.0
|
||||||
|
|
||||||
|
[node name="Label" type="Label" parent="ExitPopup/PanelContainer/VBoxContainer"]
|
||||||
|
margin_right = 113.0
|
||||||
|
margin_bottom = 10.0
|
||||||
|
text = "Return to menu?"
|
||||||
|
align = 1
|
||||||
|
|
||||||
|
[node name="HBoxContainer" type="HBoxContainer" parent="ExitPopup/PanelContainer/VBoxContainer"]
|
||||||
|
margin_top = 14.0
|
||||||
|
margin_right = 113.0
|
||||||
|
margin_bottom = 24.0
|
||||||
|
custom_constants/separation = 8
|
||||||
|
alignment = 1
|
||||||
|
|
||||||
|
[node name="StayHere" type="Button" parent="ExitPopup/PanelContainer/VBoxContainer/HBoxContainer"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
margin_right = 49.0
|
||||||
|
margin_bottom = 10.0
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
text = "No way!"
|
||||||
|
|
||||||
|
[node name="ExitMenu" type="Button" parent="ExitPopup/PanelContainer/VBoxContainer/HBoxContainer"]
|
||||||
|
margin_left = 57.0
|
||||||
|
margin_right = 113.0
|
||||||
|
margin_bottom = 10.0
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
text = "yeppers!"
|
||||||
|
|
||||||
|
[connection signal="pressed" from="ExitPopup/PanelContainer/VBoxContainer/HBoxContainer/StayHere" to="." method="_on_StayHere_pressed"]
|
||||||
|
[connection signal="pressed" from="ExitPopup/PanelContainer/VBoxContainer/HBoxContainer/ExitMenu" to="." method="_on_ExitMenu_pressed"]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue