This commit is contained in:
mathias 2020-02-02 11:28:29 +01:00
commit c0074f7141
3 changed files with 79 additions and 17 deletions

View File

@ -1,12 +1,15 @@
extends Node
const _main_menu_path = "res://UI/MainMenu.tscn"
const _body_build_path = "res://BodyConfig/bodyBuilderMenu.tscn"
const _fighting_path = "res://Ingame/Testing.tscn"
const _win_screen_path = "res://UI/WinScreen.tscn"
var _main_menu_scene
var _body_build_scene
var _fighting_scene
var _win_screen_scene
var _bodies : Array
var _body_count = 0
var _body_positions = [Vector3(0, 15, -30), Vector3(0, 15, 30), Vector3(-30, 15, 0), Vector3(30, 15, 0)]
@ -14,15 +17,17 @@ var _body_positions = [Vector3(0, 15, -30), Vector3(0, 15, 30), Vector3(-30, 15,
func _ready():
InGameState.player_count = 2
_prep_scene("body_build")
_prep_scene("fight_scene")
_prep_scene("win_screen")
_prep_scene("main_menu")
_switch_scene(_body_build_scene, "body_build")
_switch_scene(_main_menu_scene, "main_menu")
func _prep_scene(scene_name) -> Node:
if scene_name == "body_build":
if scene_name == "main_menu":
_main_menu_scene = preload(_main_menu_path).instance()
_main_menu_scene.connect("body_build", self, "_switch_to_body_build")
return _main_menu_scene
elif scene_name == "body_build":
_body_build_scene = preload(_body_build_path).instance()
_body_build_scene.connect("start_fight", self, "_switch_to_fighting")
return _body_build_scene
@ -86,3 +91,4 @@ func _switch_to_fighting(torso):
func _switch_to_body_build():
_switch_scene(_body_build_scene, "body_build")
_body_build_scene.change_count_ui()

19
UI/MainMenu.gd Normal file
View File

@ -0,0 +1,19 @@
extends Control
export(NodePath) var startPath
var _start_button
signal body_build()
func _ready():
_start_button = get_node(startPath) as Button
func _on_Start_pressed():
emit_signal("body_build")
func _on_Exit_pressed():
get_tree().quit()

View File

@ -1,5 +1,6 @@
[gd_scene load_steps=6 format=2]
[gd_scene load_steps=7 format=2]
[ext_resource path="res://UI/MainMenu.gd" type="Script" id=1]
[ext_resource path="res://Resources/Fonts/MenuHeader.tres" type="DynamicFont" id=2]
[ext_resource path="res://Resources/Fonts/MenuTextFont.tres" type="DynamicFont" id=3]
[ext_resource path="res://Resources/Styles/ButtonHoverStyle.tres" type="StyleBox" id=4]
@ -9,9 +10,11 @@
[node name="MainMenu" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
startPath = NodePath("MarginContainer2/VBoxContainer/Start")
[node name="MarginContainer" type="MarginContainer" parent="."]
anchor_left = 0.5
@ -32,15 +35,17 @@ margin_bottom = 600.0
[node name="GameName" type="Label" parent="MarginContainer/VBoxContainer"]
margin_right = 1024.0
margin_bottom = 250.0
margin_bottom = 298.0
rect_min_size = Vector2( 0, 250 )
size_flags_horizontal = 3
size_flags_vertical = 3
custom_fonts/font = ExtResource( 2 )
text = "Excrements!"
text = "D-d-d-d-d-duell"
align = 1
valign = 2
[node name="CenterContainer" type="CenterContainer" parent="MarginContainer/VBoxContainer"]
margin_top = 254.0
margin_top = 302.0
margin_right = 1024.0
margin_bottom = 600.0
size_flags_horizontal = 3
@ -49,13 +54,25 @@ __meta__ = {
"_edit_use_anchors_": false
}
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/VBoxContainer/CenterContainer"]
margin_left = 412.0
margin_top = 104.0
margin_right = 612.0
margin_bottom = 242.0
[node name="MarginContainer2" type="MarginContainer" parent="."]
anchor_left = 0.5
anchor_top = 1.0
anchor_right = 0.5
anchor_bottom = 1.0
margin_left = -100.0
margin_top = -201.0
margin_right = 100.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Start" type="Button" parent="MarginContainer/VBoxContainer/CenterContainer/VBoxContainer"]
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer2"]
margin_right = 200.0
margin_bottom = 201.0
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="Start" type="Button" parent="MarginContainer2/VBoxContainer"]
margin_right = 200.0
margin_bottom = 67.0
rect_min_size = Vector2( 200, 25 )
@ -68,10 +85,19 @@ __meta__ = {
"_edit_use_anchors_": false
}
[node name="Exit" type="Button" parent="MarginContainer/VBoxContainer/CenterContainer/VBoxContainer"]
[node name="SpacerDots2" type="Control" parent="MarginContainer2/VBoxContainer"]
margin_top = 71.0
margin_right = 200.0
margin_bottom = 138.0
margin_bottom = 91.0
rect_min_size = Vector2( 0, 20 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Exit" type="Button" parent="MarginContainer2/VBoxContainer"]
margin_top = 95.0
margin_right = 200.0
margin_bottom = 162.0
rect_min_size = Vector2( 200, 25 )
custom_styles/hover = ExtResource( 4 )
custom_styles/pressed = ExtResource( 5 )
@ -81,3 +107,14 @@ text = "Disenjoy"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="SpacerDots" type="Control" parent="MarginContainer2/VBoxContainer"]
margin_top = 166.0
margin_right = 200.0
margin_bottom = 201.0
rect_min_size = Vector2( 0, 35 )
__meta__ = {
"_edit_use_anchors_": false
}
[connection signal="pressed" from="MarginContainer2/VBoxContainer/Start" to="." method="_on_Start_pressed"]
[connection signal="pressed" from="MarginContainer2/VBoxContainer/Exit" to="." method="_on_Exit_pressed"]