fixed level loading and starting to setup proper gyms, zoos and playtest levels
All checks were successful
All checks were successful
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
extends Control
|
||||
class_name LevelSelectMenu
|
||||
|
||||
## Loads a simple ItemList node within a margin container. SceneLister updates
|
||||
## the available scenes in the directory provided. Activating a level will update
|
||||
@@ -29,5 +30,5 @@ func add_levels_to_container() -> void:
|
||||
level_buttons_container.add_item(button_name)
|
||||
|
||||
func _on_level_buttons_container_item_activated(index: int) -> void:
|
||||
GameState.set_current_level(index)
|
||||
level_selected.emit()
|
||||
var level_to_load = scene_lister.files.get(index)
|
||||
SceneLoader.load_scene(level_to_load)
|
||||
|
||||
@@ -43,7 +43,7 @@ item_0/text = "1 - ExampleLevel"
|
||||
|
||||
[node name="SceneLister" type="Node" parent="." unique_id=149935027]
|
||||
script = ExtResource("3_stdqw")
|
||||
files = Array[String](["res://maps/level1.tscn", "res://maps/city.tscn", "res://maps/GYMs/enemies.tscn", "res://maps/GYMs/metrics.tscn"])
|
||||
directory = "res://menus/scenes/game_scene/levels"
|
||||
files = Array[String](["res://maps/level1.tscn", "res://maps/city.tscn", "res://maps/GYMs/metrics.tscn"])
|
||||
directory = "res://maps"
|
||||
|
||||
[connection signal="item_activated" from="Control/LevelButtonsContainer" to="." method="_on_level_buttons_container_item_activated"]
|
||||
|
||||
@@ -4,7 +4,27 @@ class_name Toolbox
|
||||
extends OverlaidMenu
|
||||
|
||||
@export var player: PlayerController
|
||||
@export var level_selection_menu: PackedScene = preload("uid://fybssggvts5q")
|
||||
|
||||
@onready var player_invicible_toggle: CheckButton = %PlayerInvicibleToggle
|
||||
|
||||
func _ready() -> void:
|
||||
player_invicible_toggle.button_pressed = player.IsInvincibleOverride
|
||||
|
||||
|
||||
func _on_kill_player_button_pressed() -> void:
|
||||
get_tree().create_timer(1).timeout.connect(player.Kill)
|
||||
close()
|
||||
|
||||
func _on_player_invicible_toggled(toggled_on: bool) -> void:
|
||||
player.IsInvincibleOverride = toggled_on
|
||||
print(player.IsInvincible)
|
||||
|
||||
|
||||
func _on_restart_current_level_pressed() -> void:
|
||||
SceneLoader.reload_current_scene()
|
||||
|
||||
|
||||
func _on_select_level_pressed() -> void:
|
||||
var menu: LevelSelectMenu = level_selection_menu.instantiate()
|
||||
add_child(menu)
|
||||
|
||||
@@ -50,29 +50,69 @@ theme_override_font_sizes/font_size = 24
|
||||
text = "Toolbox"
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="PlayerSection" type="MarginContainer" parent="MarginContainer/MenuPanelContainer/MarginContainer/BoxContainer" unique_id=461792371]
|
||||
[node name="PlayerSectionMargin" type="MarginContainer" parent="MarginContainer/MenuPanelContainer/MarginContainer/BoxContainer" unique_id=461792371]
|
||||
layout_mode = 2
|
||||
theme_override_constants/margin_top = 16
|
||||
theme_override_constants/margin_bottom = 16
|
||||
|
||||
[node name="MenuButtons" type="BoxContainer" parent="MarginContainer/MenuPanelContainer/MarginContainer/BoxContainer/PlayerSection" unique_id=469432036]
|
||||
unique_name_in_owner = true
|
||||
[node name="PlayerSection" type="BoxContainer" parent="MarginContainer/MenuPanelContainer/MarginContainer/BoxContainer/PlayerSectionMargin" unique_id=469432036]
|
||||
custom_minimum_size = Vector2(128, 0)
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 4
|
||||
size_flags_vertical = 3
|
||||
theme_override_constants/separation = 16
|
||||
alignment = 1
|
||||
vertical = true
|
||||
script = ExtResource("2_6ax4q")
|
||||
|
||||
[node name="PlayerSectionLabel" type="Label" parent="MarginContainer/MenuPanelContainer/MarginContainer/BoxContainer/PlayerSection/MenuButtons" unique_id=1100827847]
|
||||
[node name="PlayerSectionLabel" type="Label" parent="MarginContainer/MenuPanelContainer/MarginContainer/BoxContainer/PlayerSectionMargin/PlayerSection" unique_id=1100827847]
|
||||
layout_mode = 2
|
||||
text = "Player"
|
||||
|
||||
[node name="KillPlayerButton" type="Button" parent="MarginContainer/MenuPanelContainer/MarginContainer/BoxContainer/PlayerSection/MenuButtons" unique_id=472828424]
|
||||
[node name="PlayerUtilsContainer" type="HBoxContainer" parent="MarginContainer/MenuPanelContainer/MarginContainer/BoxContainer/PlayerSectionMargin/PlayerSection" unique_id=993608648]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 4
|
||||
theme_override_constants/separation = 8
|
||||
|
||||
[node name="PlayerInvicibleToggle" type="CheckButton" parent="MarginContainer/MenuPanelContainer/MarginContainer/BoxContainer/PlayerSectionMargin/PlayerSection/PlayerUtilsContainer" unique_id=960956060]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "Invincible"
|
||||
script = ExtResource("2_6ax4q")
|
||||
|
||||
[node name="KillPlayerButton" type="Button" parent="MarginContainer/MenuPanelContainer/MarginContainer/BoxContainer/PlayerSectionMargin/PlayerSection/PlayerUtilsContainer" unique_id=472828424]
|
||||
layout_mode = 2
|
||||
text = "Kill in 1s"
|
||||
|
||||
[connection signal="pressed" from="MarginContainer/MenuPanelContainer/MarginContainer/BoxContainer/PlayerSection/MenuButtons/KillPlayerButton" to="." method="_on_kill_player_button_pressed"]
|
||||
[node name="LevelSelectionMargin" type="MarginContainer" parent="MarginContainer/MenuPanelContainer/MarginContainer/BoxContainer" unique_id=517648431]
|
||||
layout_mode = 2
|
||||
theme_override_constants/margin_top = 16
|
||||
theme_override_constants/margin_bottom = 16
|
||||
|
||||
[node name="LevelSelectionSection" type="BoxContainer" parent="MarginContainer/MenuPanelContainer/MarginContainer/BoxContainer/LevelSelectionMargin" unique_id=2038380087]
|
||||
custom_minimum_size = Vector2(128, 0)
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
theme_override_constants/separation = 16
|
||||
vertical = true
|
||||
|
||||
[node name="LevelSelectionLabel" type="Label" parent="MarginContainer/MenuPanelContainer/MarginContainer/BoxContainer/LevelSelectionMargin/LevelSelectionSection" unique_id=950442689]
|
||||
layout_mode = 2
|
||||
text = "Levels"
|
||||
|
||||
[node name="LevelSelectionContainer" type="HBoxContainer" parent="MarginContainer/MenuPanelContainer/MarginContainer/BoxContainer/LevelSelectionMargin/LevelSelectionSection" unique_id=1674253271]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 4
|
||||
theme_override_constants/separation = 8
|
||||
|
||||
[node name="RestartCurrentButton" type="Button" parent="MarginContainer/MenuPanelContainer/MarginContainer/BoxContainer/LevelSelectionMargin/LevelSelectionSection/LevelSelectionContainer" unique_id=1059727667]
|
||||
layout_mode = 2
|
||||
text = "Restart current
|
||||
"
|
||||
|
||||
[node name="SelectLevel" type="Button" parent="MarginContainer/MenuPanelContainer/MarginContainer/BoxContainer/LevelSelectionMargin/LevelSelectionSection/LevelSelectionContainer" unique_id=2015444126]
|
||||
layout_mode = 2
|
||||
text = "Select levet
|
||||
"
|
||||
|
||||
[connection signal="toggled" from="MarginContainer/MenuPanelContainer/MarginContainer/BoxContainer/PlayerSectionMargin/PlayerSection/PlayerUtilsContainer/PlayerInvicibleToggle" to="." method="_on_player_invicible_toggled"]
|
||||
[connection signal="pressed" from="MarginContainer/MenuPanelContainer/MarginContainer/BoxContainer/PlayerSectionMargin/PlayerSection/PlayerUtilsContainer/KillPlayerButton" to="." method="_on_kill_player_button_pressed"]
|
||||
[connection signal="pressed" from="MarginContainer/MenuPanelContainer/MarginContainer/BoxContainer/LevelSelectionMargin/LevelSelectionSection/LevelSelectionContainer/RestartCurrentButton" to="." method="_on_restart_current_level_pressed"]
|
||||
[connection signal="pressed" from="MarginContainer/MenuPanelContainer/MarginContainer/BoxContainer/LevelSelectionMargin/LevelSelectionSection/LevelSelectionContainer/SelectLevel" to="." method="_on_select_level_pressed"]
|
||||
|
||||
Reference in New Issue
Block a user