Browse Source

escape button

master
Ententerminator 4 years ago
parent
commit
9de159accd
  1. 5
      Controllers/GameStateController.gd
  2. 17
      Ingame/Ingame.gd
  3. 64
      Ingame/Testing.tscn

5
Controllers/GameStateController.gd

@ -34,6 +34,7 @@ func _prep_scene(scene_name) -> Node:
elif scene_name == "fight_scene":
_fighting_scene = preload(_fighting_path).instance()
InGameState.connect("player_win", self, "_switch_to_win")
_fighting_scene.connect("main_menu", self, "_switch_to_main_menu")
return _fighting_scene
elif scene_name == "win_screen":
_win_screen_scene = preload(_win_screen_path).instance()
@ -95,3 +96,7 @@ func _switch_to_fighting(torso):
func _switch_to_body_build():
_switch_scene(_body_build_scene, "body_build")
_body_build_scene.change_count_ui()
func _switch_to_main_menu():
_switch_scene(_main_menu_scene, "main_menu")

17
Ingame/Ingame.gd

@ -1,16 +1,27 @@
extends Spatial
export(NodePath) var escPath
# Declare member variables here. Examples:
# var a: int = 2
# var b: String = "text"
var _esc_button
var _esc_visible : bool = false
signal main_menu()
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
InGameState.set_player_count(2)
_esc_button = get_node(escPath) as Button
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta: float) -> void:
# pass
func _input(event):
if event is InputEventKey and event.pressed and event.scancode == KEY_ESCAPE:
_esc_visible = !(_esc_visible)
_esc_button.visible = _esc_visible
func _on_ESC_Menu_pressed():
emit_signal ("main_menu")

64
Ingame/Testing.tscn

@ -1,19 +1,55 @@
[gd_scene load_steps=5 format=2]
[gd_scene load_steps=9 format=2]
[ext_resource path="res://Resources/Fonts/MenuTextFont.tres" type="DynamicFont" id=1]
[ext_resource path="res://UI/UI.tscn" type="PackedScene" id=2]
[ext_resource path="res://Resources/Styles/ButtonHoverStyle.tres" type="StyleBox" id=3]
[ext_resource path="res://Ingame/Ingame.gd" type="Script" id=4]
[ext_resource path="res://Ingame/Arena.tscn" type="PackedScene" id=5]
[ext_resource path="res://Ingame/CameraFocus.gd" type="Script" id=6]
[ext_resource path="res://Resources/Styles/ButtonNormalStyle.tres" type="StyleBox" id=7]
[ext_resource path="res://Resources/Styles/ButtonPressedStyle.tres" type="StyleBox" id=8]
[node name="InGame" type="Spatial"]
script = ExtResource( 4 )
escPath = NodePath("UI/ESC Menu")
[node name="UI" parent="." instance=ExtResource( 2 )]
[node name="ESC Menu" type="Button" parent="UI"]
visible = false
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -100.0
margin_top = -33.5
margin_right = 100.0
margin_bottom = 33.5
custom_styles/hover = ExtResource( 3 )
custom_styles/pressed = ExtResource( 8 )
custom_styles/normal = ExtResource( 7 )
custom_fonts/font = ExtResource( 1 )
text = "Escape"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Arena" parent="." instance=ExtResource( 5 )]
[node name="PathFollow" parent="Arena/Path" index="0"]
transform = Transform( -0.564546, 0, 0.825401, 0, 1, 0, -0.825402, 0, -0.564546, -43.137, 0, -40.2265 )
[node name="PathFollow2" parent="Arena/Path" index="1"]
transform = Transform( -0.389933, 0, 0.920842, 0, 1, 0, -0.920843, 0, -0.389933, -22.4314, 0, -51.2965 )
[node name="PathFollow3" parent="Arena/Path" index="2"]
transform = Transform( 0.0525302, 0, 0.998617, 0, 1, 0, -0.998619, 0, 0.05253, 1.77306, 0, -55.9514 )
transform = Transform( 0.0525302, 0, 0.998616, 0, 1, 0, -0.998619, 0, 0.05253, 1.77306, 0, -55.9514 )
[node name="PathFollow4" parent="Arena/Path" index="3"]
transform = Transform( 0.412629, 0, 0.910899, 0, 1, 0, -0.9109, 0, 0.412628, 25.6454, 0, -49.4766 )
[node name="PathFollow5" parent="Arena/Path" index="4"]
transform = Transform( 0.868863, 0, 0.495052, 0, 1, 0, -0.495052, 0, 0.868862, 45.3036, 0, -34.9361 )
[node name="PathFollow6" parent="Arena/Path" index="5"]
transform = Transform( 0.951672, 0, 0.307114, 0, 1, 0, -0.307114, 0, 0.951672, 54.056, 0, -11.6692 )
@ -21,19 +57,41 @@ transform = Transform( 0.951672, 0, 0.307114, 0, 1, 0, -0.307114, 0, 0.951672, 5
[node name="PathFollow7" parent="Arena/Path" index="6"]
transform = Transform( 0.989853, 0, 0.142099, 0, 1, 0, -0.142099, 0, 0.98985, 60.6244, 0, 12.2053 )
[node name="PathFollow8" parent="Arena/Path" index="7"]
transform = Transform( 0.978626, 1.91684e-07, -0.205647, -1.784e-07, 1, 8.31393e-08, 0.205648, -4.46748e-08, 0.978625, 58.2582, -2.03301e-05, 36.846 )
[node name="PathFollow9" parent="Arena/Path" index="8"]
transform = Transform( 0.760079, -6.86382e-07, -0.64983, 7.11587e-07, 1, -2.23935e-07, 0.649831, -2.92203e-07, 0.760078, 48.2851, 2.0276e-05, 59.2494 )
[node name="PathFollow10" parent="Arena/Path" index="9"]
transform = Transform( 0.425147, -4.37703e-07, -0.905123, 3.06861e-07, 1, -3.39447e-07, 0.905124, -1.33432e-07, 0.425147, 28.181, -7.98279e-07, 73.5253 )
[node name="PathFollow11" parent="Arena/Path" index="10"]
transform = Transform( 0.126477, -1.61642e-07, -0.991968, 1.13677e-07, 1, -1.48456e-07, 0.991969, -9.39879e-08, 0.126477, 4.35371, -1.51216e-05, 79.9373 )
[node name="PathFollow12" parent="Arena/Path" index="11"]
transform = Transform( -0.305839, 5.41201e-07, -0.952082, 4.12144e-07, 1, 4.36044e-07, 0.952083, -2.59036e-07, -0.305838, -20.2565, -9.77015e-07, 79.0522 )
[node name="PathFollow13" parent="Arena/Path" index="12"]
transform = Transform( -0.625119, 2.66822e-07, -0.780529, 4.26834e-07, 1, 0, 0.780529, -3.33157e-07, -0.625118, -42.0269, 0, 67.1875 )
[node name="PathFollow14" parent="Arena/Path" index="13"]
transform = Transform( -0.916028, 3.908e-07, -0.401115, 4.26625e-07, 1, 0, 0.401116, -1.71126e-07, -0.916026, -56.2049, 0, 47.1929 )
[node name="PathFollow15" parent="Arena/Path" index="14"]
transform = Transform( -0.986687, 4.21016e-07, -0.162631, 4.26697e-07, 1, 0, 0.162631, -6.93941e-08, -0.986685, -63.4917, 0, 23.5427 )
[node name="PathFollow16" parent="Arena/Path" index="15"]
transform = Transform( -0.999998, 4.26235e-07, -0.00197735, 4.26236e-07, 1, 0, 0.00197735, -8.42818e-10, -0.999997, -65.6734, 0, -1.33537 )
transform = Transform( -0.999998, 4.26235e-07, -0.00197735, 4.26236e-07, 1, 0, 0.00197735, -8.42818e-10, -0.999998, -65.6734, 0, -1.33537 )
[node name="PathFollow17" parent="Arena/Path" index="16"]
transform = Transform( -0.817611, 3.47972e-07, 0.57577, 4.25597e-07, 1, 0, -0.575771, 2.45046e-07, -0.817609, -57.8267, 0, -24.3573 )
[node name="CameraFocus" type="Spatial" parent="."]
script = ExtResource( 6 )
[node name="Camera" type="Camera" parent="CameraFocus"]
transform = Transform( -4.2222e-08, -0.707107, 0.707107, -1.13133e-08, 0.707107, 0.707107, -1, 2.18557e-08, -3.78552e-08, 19, 17, -2 )
[connection signal="pressed" from="UI/ESC Menu" to="." method="_on_ESC_Menu_pressed"]
[editable path="Arena"]
Loading…
Cancel
Save