From fbadc76d4fb8cbff779997bcf404d28911c1c1ca Mon Sep 17 00:00:00 2001 From: ValliantStorme Date: Tue, 19 Oct 2021 00:10:13 -0500 Subject: [PATCH 01/13] Pushing what I have of the debug menu so I don't forget. TODO: Pulldown keypress, command processing. --- godot_ship/main.tres | 4 ++++ godot_ship/scenes/Debug Menu.tscn | 29 ++++++++++++++++++++++++++- godot_ship/script/debug/debug_menu.gd | 16 +++++++++++++++ 3 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 godot_ship/main.tres create mode 100644 godot_ship/script/debug/debug_menu.gd diff --git a/godot_ship/main.tres b/godot_ship/main.tres new file mode 100644 index 0000000..51effda --- /dev/null +++ b/godot_ship/main.tres @@ -0,0 +1,4 @@ +[gd_resource type="Theme" format=2] + +[resource] +resource_name = "Main Theme" diff --git a/godot_ship/scenes/Debug Menu.tscn b/godot_ship/scenes/Debug Menu.tscn index 2ee2025..3076839 100644 --- a/godot_ship/scenes/Debug Menu.tscn +++ b/godot_ship/scenes/Debug Menu.tscn @@ -1,8 +1,35 @@ -[gd_scene format=2] +[gd_scene load_steps=3 format=2] + +[ext_resource path="res://main.tres" type="Theme" id=1] +[ext_resource path="res://script/debug/debug_menu.gd" type="Script" id=2] [node name="Debug" type="Control"] anchor_right = 1.0 anchor_bottom = 1.0 +theme = ExtResource( 1 ) +script = ExtResource( 2 ) __meta__ = { "_edit_use_anchors_": false } + +[node name="VBoxContainer" type="VBoxContainer" parent="."] +anchor_right = 1.0 +anchor_bottom = 1.0 +custom_constants/separation = 2 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="TextEdit" type="TextEdit" parent="VBoxContainer"] +margin_right = 640.0 +margin_bottom = 144.0 +rect_min_size = Vector2( 0, 144 ) +text = "Turn 0 +Player 1: 0 ships, 0 hits, 0 misses" + +[node name="LineEdit" type="LineEdit" parent="VBoxContainer"] +margin_top = 146.0 +margin_right = 640.0 +margin_bottom = 170.0 +text = ">" +caret_blink = true diff --git a/godot_ship/script/debug/debug_menu.gd b/godot_ship/script/debug/debug_menu.gd new file mode 100644 index 0000000..bb9bd06 --- /dev/null +++ b/godot_ship/script/debug/debug_menu.gd @@ -0,0 +1,16 @@ +extends Control + + +# Declare member variables here. Examples: +# var a = 2 +# var b = "text" + + +# Called when the node enters the scene tree for the first time. +func _ready(): + pass # Replace with function body. + + +# Called every frame. 'delta' is the elapsed time since the previous frame. +#func _process(delta): +# pass From ee3465a2957c18807beebffb952e120d7355de9e Mon Sep 17 00:00:00 2001 From: tommy-l-ngo Date: Tue, 19 Oct 2021 21:13:23 -0500 Subject: [PATCH 02/13] Updated Title Screen - Added buttons that change scene - Added Background --- ...d.png-0858ea44e9c9235fceac088a9c0f7d28.md5 | 3 + ....png-0858ea44e9c9235fceac088a9c0f7d28.stex | Bin 0 -> 8689 bytes godot_ship/scenes/Title Screen.gd | 29 ++++++++++ godot_ship/scenes/Title Screen.tscn | 53 +++++++++++++++++- godot_ship/scenes/Title-Screen-Background.png | Bin 0 -> 9397 bytes .../scenes/Title-Screen-Background.png.import | 34 +++++++++++ 6 files changed, 118 insertions(+), 1 deletion(-) create mode 100644 godot_ship/.import/Title-Screen-Background.png-0858ea44e9c9235fceac088a9c0f7d28.md5 create mode 100644 godot_ship/.import/Title-Screen-Background.png-0858ea44e9c9235fceac088a9c0f7d28.stex create mode 100644 godot_ship/scenes/Title Screen.gd create mode 100644 godot_ship/scenes/Title-Screen-Background.png create mode 100644 godot_ship/scenes/Title-Screen-Background.png.import diff --git a/godot_ship/.import/Title-Screen-Background.png-0858ea44e9c9235fceac088a9c0f7d28.md5 b/godot_ship/.import/Title-Screen-Background.png-0858ea44e9c9235fceac088a9c0f7d28.md5 new file mode 100644 index 0000000..65f245f --- /dev/null +++ b/godot_ship/.import/Title-Screen-Background.png-0858ea44e9c9235fceac088a9c0f7d28.md5 @@ -0,0 +1,3 @@ +source_md5="a88d669f1f058a347cc4de2244bac64b" +dest_md5="1073062c6e594eff250036d7489d44a7" + diff --git a/godot_ship/.import/Title-Screen-Background.png-0858ea44e9c9235fceac088a9c0f7d28.stex b/godot_ship/.import/Title-Screen-Background.png-0858ea44e9c9235fceac088a9c0f7d28.stex new file mode 100644 index 0000000000000000000000000000000000000000..1ea8a2a7bec397add7b1da989202550a02af9110 GIT binary patch literal 8689 zcmZvCbzGBQ*!~Pa0Yw^Qlyr?Q2}MN&1V)QA(gyNtH%I6loaUF_4fPB^^^~ zDaiqo?L~b*FZ}%e_Q$r*v(LGobME`Puj@KzkIFq=y}l(?)SHK86 z007ohVGBEXyFz-M^yJbN)d%-<0D$v>0Khr>ODAIh55P0TCm-ivIx2SnNHlN-0AK^C z-c!=^PFiJbjFW^UD1zdF=^0+JhxO^o+XmKar~|C6K<0)`pGb`s5mcthzD<@@NfQ&7V9RbC3p)5rt%(-yuf_W9 zZ`NXcQ1~sk#{SwR?0jNsEk+Bq1S)(~3jOeH48HV)ADhPdO5VS;twatxBds9geB6x} zK$XtD-1)V*NAZJ@AyeiZF;XB;(#!yCGOS_Sz$yXh(phQLCun|Ylm+YeDr(Z|LW zOW+?`(60mdIrJq0&3Ql|)uX_30B}i$e$a+kf7Z$!s5Spr`^s3)d5%b&Xd$Ot52004*tn*jh`d(Z``MOpHFcH$0G zzT%u+5gF)tMHt(K5DL3TQ;$U+7JuOsVYu3jfS2H&ue2nmd9pY<1oI+fnAG z_u5*QUE>e+J-hSpVEo>-P-ge2BP9VKLGh)>N`uW3-pXw{{@(>AeU|!YOFiB2kY$Y= zfoPKy_Sk|rQk5?)AB%;ikjTL>p!pWp>+USm{Z~UO#Vp|ej<^3nabRfvlXdX`#(J>+ zl5&xAbcAY50r>GwfoLEfj~>3KZZ%4}!Yv-s zawcS7C3|u@Bh;{cbeuXm7W>&9owF#NTzy|i4b$u9Iv!4?iO%2ls0QttU%OYR9>E`% zDV^pz0GxvG@^gNW=%W?^07(B-zxn)05`#R&zuGfaTkN6?$JU1smc|2GAJflGec!gQ z!|CqY4_058Ok`QjCL;|Iux^%;qmUvcYHf(V1_;b9{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C$Bq2ZqsDWmQzTCigaAvHAIv&lK!Vp4rv!4MrYv?foEG2}pN>G00P z&#yz%luY-)QH};e$ZkdMfA34DIayQGRUsY9p|2ecy_5qtOaoI)J@+TDi?11`)Vr9)+-cq)h$6x+G%=YsrOJf+} zkK@3!Diaq9Y~biov%41K$t16eWxeq#%oV*Rs5BL#AMJAP__5I$ukquOiyX$HOdYn4d(Y{@X9NiRHbEY??K#M5aHP#rNEg?hcvT&!-_GYRz%+f7mAU zxCDp8?4!Jg@50dpD_nKYrEWxj{Z}hOg!-d;kVVzY3@Y(6$^s5z$yd@#$9aro8IKnX z@#TU{VJ95H_G8GDYnhd`&SrleF_!8a-R|b@dwEi|5yTu7Q za+&2EhEz)HW>Y#t5IX(KWP#XAaZb>elsH4M;j7_2^M((EpbV_xq)&#o|`&+*G1H0(`=WP zu-@pP)Mev7y*l3;C;<66@h;m-BRiNIG#I9C*OwkSRWQU&+bhKOKx*l4Exi8 z1|lZn3d|(`8g;?c3TVn9E86+eaEdNM1{Y`?!4!oYyBdDZv13_!ZZXaD?J*u<{Y=HW z=X=n%mW3whn#H5F3sqslHG*TT@&d;w+wuJx_43|}VQ0{r5TB8@z42-pDCB}uRkjix zHVQ&dLG^OCrzZ_fCxN3`pS7Jq6?1tz%Er{MNMY|A`JMLBX>dHG!{2oV(Vxl!JlLYJ z)%tKoGXL`VJozKekTxh|2}6Kh!1_$58^)){H?vRm!L(Qry~)imh$8c6CK2ad!T8qG zUFH97zC+V|vl_}X&14kL*7Tl^ zW=qUKRDg>$g{=?iBTmltdD!Fa_(sWp#K3apV=}1 literal 0 HcmV?d00001 diff --git a/godot_ship/scenes/Title Screen.gd b/godot_ship/scenes/Title Screen.gd new file mode 100644 index 0000000..51d6f25 --- /dev/null +++ b/godot_ship/scenes/Title Screen.gd @@ -0,0 +1,29 @@ +extends Control + + +# Declare member variables here. Examples: +# var a = 2 +# var b = "text" + + +# Called when the node enters the scene tree for the first time. +func _ready(): + $VBoxContainer/Singleplayer.grab_focus() + + +# Called every frame. 'delta' is the elapsed time since the previous frame. +#func _process(delta): +# pass + + +func _on_Singleplayer_pressed(): + get_tree().change_scene("res://scenes/Gameplay.tscn") + +func _on_Multiplayer_pressed(): + get_tree().change_scene("res://scenes/Gameplay.tscn") + +func _on_Options_pressed(): + get_tree().change_scene("res://scenes/Options.tscn") + +func _on_Quit_pressed(): + get_tree().quit() diff --git a/godot_ship/scenes/Title Screen.tscn b/godot_ship/scenes/Title Screen.tscn index 7127ecc..f0133f8 100644 --- a/godot_ship/scenes/Title Screen.tscn +++ b/godot_ship/scenes/Title Screen.tscn @@ -1,8 +1,59 @@ -[gd_scene format=2] +[gd_scene load_steps=3 format=2] + +[ext_resource path="res://scenes/Title-Screen-Background.png" type="Texture" id=1] +[ext_resource path="res://scenes/Title Screen.gd" type="Script" id=2] [node name="Title Node" type="Control"] anchor_right = 1.0 anchor_bottom = 1.0 +script = ExtResource( 2 ) __meta__ = { "_edit_use_anchors_": false } + +[node name="Title-Screen-Background" type="Sprite" parent="."] +position = Vector2( 320, 180 ) +texture = ExtResource( 1 ) + +[node name="VBoxContainer" type="VBoxContainer" parent="."] +anchor_left = 0.5 +anchor_top = 1.0 +anchor_right = 0.5 +anchor_bottom = 1.0 +margin_left = -46.5 +margin_top = -171.0 +margin_right = 46.5 +margin_bottom = -79.0 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Singleplayer" type="Button" parent="VBoxContainer"] +margin_right = 93.0 +margin_bottom = 20.0 +focus_neighbour_top = NodePath("../Quit") +text = "Single Player" + +[node name="Multiplayer" type="Button" parent="VBoxContainer"] +margin_top = 24.0 +margin_right = 93.0 +margin_bottom = 44.0 +text = "Multiplayer" + +[node name="Options" type="Button" parent="VBoxContainer"] +margin_top = 48.0 +margin_right = 93.0 +margin_bottom = 68.0 +text = "Options" + +[node name="Quit" type="Button" parent="VBoxContainer"] +margin_top = 72.0 +margin_right = 93.0 +margin_bottom = 92.0 +focus_neighbour_bottom = NodePath("../Singleplayer") +text = "Quit" + +[connection signal="pressed" from="VBoxContainer/Singleplayer" to="." method="_on_Singleplayer_pressed"] +[connection signal="pressed" from="VBoxContainer/Multiplayer" to="." method="_on_Multiplayer_pressed"] +[connection signal="pressed" from="VBoxContainer/Options" to="." method="_on_Options_pressed"] +[connection signal="pressed" from="VBoxContainer/Quit" to="." method="_on_Quit_pressed"] diff --git a/godot_ship/scenes/Title-Screen-Background.png b/godot_ship/scenes/Title-Screen-Background.png new file mode 100644 index 0000000000000000000000000000000000000000..830ec9b06815493c3f0b78845ed6cae54826b8e2 GIT binary patch literal 9397 zcmbVScUaQv+s9LBL-RCTIdgAtZ#`vcR_<`5rY1NM+*`3stxPLt=Bmuhy>jF>HFKnC zE=0ju4seSJg7248o!@z{>vz3>y!<14dG7nU=jR^yz{E(O<@mYdAP|Vf;L0U45a^Fc z5QxF`=pVq7D<)Hnz#lHZ%T|8oC}+PwM;|!o0t|H)vY6-42vbi68xL5I`E$U7%V98 z_Ypr2Ey15cSs9uL=%Re!0!p&VGEQ=eN&+fsvU17_ifU@o0`d?!RWL*qETw3B zQJ0q&`1KM5Zu5aTtD9ZY`*j!aNlVbx&(BL83=RwolnqpnMftdZ< zLdG{3>E{?EgY*^p&EXQ<*U87t%g+sk6rgi-yp8hr(-H(E{i%Ydm!aW5jFG;-3Q=r=K7yZ`$l`awV% zbz>hlz$uQ1ODHFQPdL)g;F6Xg@Qp0Y4W_QF43~#1L6l@1;Sjit8eCCM#?e_(LFV>t zH3-B}O-0Sw+37c*|32hmf#tSGM_r>HC^cUkx1B}F+kU1jAFMfst8T~S^Fy1I0)s|ko(x*=hx zKwk;En|^A23GU+-0Eg-MpgaZswzIn1f04lv<^;K|1c%6|!j<7Nj&h3ffF}A zAc~5r$`D66N5Nn8u>Y_9z<^L-da(Q}cz!~pS-!VFYpXDwN2t2pcT^Ubzu;}7m;hG*H{~lWCM~y4bkbb-rQVdDwOvT$O+P%`C9o9)kq79XMKU;WiKa0y zk&{Pz89zcLP=>_z=~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XK;Uib1RuP-HzbpIC;`sz zg|SDkBZ&tdG2FNOs=DdWN3R7h3BaPvzd`%9&%4S6G5us2XVGh4rUH0&ZUo~Vx%trS7GKLX()+m-LP@oZ8qQNeL|^-PRV4fe`VVH1;9`(&rv2bq R`acpGTsFE?dePzT{{Wf8vgZH* literal 0 HcmV?d00001 diff --git a/godot_ship/scenes/Title-Screen-Background.png.import b/godot_ship/scenes/Title-Screen-Background.png.import new file mode 100644 index 0000000..61bcece --- /dev/null +++ b/godot_ship/scenes/Title-Screen-Background.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/Title-Screen-Background.png-0858ea44e9c9235fceac088a9c0f7d28.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://scenes/Title-Screen-Background.png" +dest_files=[ "res://.import/Title-Screen-Background.png-0858ea44e9c9235fceac088a9c0f7d28.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 From b12bf4a98e3a6052bd3204b20c2158417dcb973c Mon Sep 17 00:00:00 2001 From: ValliantStorme Date: Tue, 19 Oct 2021 22:14:30 -0500 Subject: [PATCH 03/13] Implement debug console drop-down (no commands just yet) and fix UI keybinds. --- godot_ship/project.godot | 36 ++++++++++++++++++++ godot_ship/scenes/Debug Menu.tscn | 14 ++++++-- godot_ship/scenes/Main.tscn | 17 +++++++-- godot_ship/scenes/MultiplayerController.tscn | 6 ++++ godot_ship/script/debug/debug_menu.gd | 33 ++++++++++++++---- 5 files changed, 94 insertions(+), 12 deletions(-) create mode 100644 godot_ship/scenes/MultiplayerController.tscn diff --git a/godot_ship/project.godot b/godot_ship/project.godot index 53d1401..2613626 100644 --- a/godot_ship/project.godot +++ b/godot_ship/project.godot @@ -20,6 +20,42 @@ window/size/width=640 window/size/height=360 window/per_pixel_transparency/allowed=true +[input] + +ui_left={ +"deadzone": 0.5, +"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777231,"unicode":0,"echo":false,"script":null) +, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":14,"pressure":0.0,"pressed":false,"script":null) +, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":65,"unicode":0,"echo":false,"script":null) + ] +} +ui_right={ +"deadzone": 0.5, +"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777233,"unicode":0,"echo":false,"script":null) +, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":15,"pressure":0.0,"pressed":false,"script":null) +, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":68,"unicode":0,"echo":false,"script":null) + ] +} +ui_up={ +"deadzone": 0.5, +"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777232,"unicode":0,"echo":false,"script":null) +, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":12,"pressure":0.0,"pressed":false,"script":null) +, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":87,"unicode":0,"echo":false,"script":null) + ] +} +ui_down={ +"deadzone": 0.5, +"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777234,"unicode":0,"echo":false,"script":null) +, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":13,"pressure":0.0,"pressed":false,"script":null) +, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":83,"unicode":0,"echo":false,"script":null) + ] +} +ui_debug={ +"deadzone": 0.5, +"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":96,"unicode":0,"echo":false,"script":null) + ] +} + [physics] common/enable_pause_aware_picking=true diff --git a/godot_ship/scenes/Debug Menu.tscn b/godot_ship/scenes/Debug Menu.tscn index 3076839..649c367 100644 --- a/godot_ship/scenes/Debug Menu.tscn +++ b/godot_ship/scenes/Debug Menu.tscn @@ -6,28 +6,36 @@ [node name="Debug" type="Control"] anchor_right = 1.0 anchor_bottom = 1.0 +margin_top = -360.0 +margin_bottom = -360.0 theme = ExtResource( 1 ) script = ExtResource( 2 ) __meta__ = { "_edit_use_anchors_": false } -[node name="VBoxContainer" type="VBoxContainer" parent="."] +[node name="debug_canvas" type="CanvasLayer" parent="."] +layer = 69 +offset = Vector2( 0, -360 ) +transform = Transform2D( 1, 0, 0, 1, 0, -360 ) + +[node name="VBoxContainer" type="VBoxContainer" parent="debug_canvas"] anchor_right = 1.0 anchor_bottom = 1.0 +margin_bottom = -180.0 custom_constants/separation = 2 __meta__ = { "_edit_use_anchors_": false } -[node name="TextEdit" type="TextEdit" parent="VBoxContainer"] +[node name="TextEdit" type="TextEdit" parent="debug_canvas/VBoxContainer"] margin_right = 640.0 margin_bottom = 144.0 rect_min_size = Vector2( 0, 144 ) text = "Turn 0 Player 1: 0 ships, 0 hits, 0 misses" -[node name="LineEdit" type="LineEdit" parent="VBoxContainer"] +[node name="LineEdit" type="LineEdit" parent="debug_canvas/VBoxContainer"] margin_top = 146.0 margin_right = 640.0 margin_bottom = 170.0 diff --git a/godot_ship/scenes/Main.tscn b/godot_ship/scenes/Main.tscn index bd41ee5..3dd2b98 100644 --- a/godot_ship/scenes/Main.tscn +++ b/godot_ship/scenes/Main.tscn @@ -1,8 +1,21 @@ -[gd_scene format=2] +[gd_scene load_steps=5 format=2] -[node name="Control" type="Control"] +[ext_resource path="res://scenes/Debug Menu.tscn" type="PackedScene" id=1] +[ext_resource path="res://scenes/Gameplay.tscn" type="PackedScene" id=2] +[ext_resource path="res://scenes/Title Screen.tscn" type="PackedScene" id=3] +[ext_resource path="res://scenes/Options.tscn" type="PackedScene" id=4] + +[node name="Root" type="Control"] anchor_right = 1.0 anchor_bottom = 1.0 __meta__ = { "_edit_use_anchors_": false } + +[node name="Title Screen" parent="." instance=ExtResource( 3 )] + +[node name="Game" parent="." instance=ExtResource( 2 )] + +[node name="Options" parent="." instance=ExtResource( 4 )] + +[node name="Debug Menu" parent="." instance=ExtResource( 1 )] diff --git a/godot_ship/scenes/MultiplayerController.tscn b/godot_ship/scenes/MultiplayerController.tscn new file mode 100644 index 0000000..d39d64e --- /dev/null +++ b/godot_ship/scenes/MultiplayerController.tscn @@ -0,0 +1,6 @@ +[gd_scene format=2] + +[node name="Control" type="Control"] +__meta__ = { +"_edit_use_anchors_": false +} diff --git a/godot_ship/script/debug/debug_menu.gd b/godot_ship/script/debug/debug_menu.gd index bb9bd06..926cc8d 100644 --- a/godot_ship/script/debug/debug_menu.gd +++ b/godot_ship/script/debug/debug_menu.gd @@ -1,16 +1,35 @@ extends Control +# Declare member variables here. +var debug_canvas +var debug_transform -# Declare member variables here. Examples: -# var a = 2 -# var b = "text" +var debug_active = false +var menu_position = 0.0 +var menu_velocity = 2 +# positions when the menu is hidden/active +var menu_hidden = Transform2D(Vector2(1,0), Vector2(0,1), Vector2(0,-180)) +var menu_active = Transform2D(Vector2(1,0), Vector2(0,1), Vector2(0, 0)) # Called when the node enters the scene tree for the first time. func _ready(): - pass # Replace with function body. - + debug_canvas = get_node("debug_canvas") + debug_transform = debug_canvas.get_transform() + return # Called every frame. 'delta' is the elapsed time since the previous frame. -#func _process(delta): -# pass +func _process(delta): + if (debug_active && menu_position < 1): + menu_position += menu_velocity * delta; + elif (!debug_active && menu_position > 0): + menu_position -= menu_velocity * delta; + else: + menu_position = round(menu_position) + + debug_canvas.set_transform(menu_hidden.interpolate_with(menu_active, menu_position)) + +func _unhandled_input(event): + if event.is_action_pressed("ui_debug"): + # open debug menu + debug_active = !debug_active; From a2f1fe6730b06afef0f38135326ce0c085d4f01d Mon Sep 17 00:00:00 2001 From: ValliantStorme Date: Tue, 19 Oct 2021 22:24:38 -0500 Subject: [PATCH 04/13] Fix scaling settings (how do force integer scale???) --- godot_ship/project.godot | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/godot_ship/project.godot b/godot_ship/project.godot index 2613626..aa0c1d4 100644 --- a/godot_ship/project.godot +++ b/godot_ship/project.godot @@ -18,7 +18,10 @@ config/icon="res://icon.png" window/size/width=640 window/size/height=360 +window/dpi/allow_hidpi=true window/per_pixel_transparency/allowed=true +window/stretch/mode="2d" +window/stretch/aspect="keep" [input] @@ -62,4 +65,6 @@ common/enable_pause_aware_picking=true [rendering] +quality/intended_usage/framebuffer_allocation=0 +2d/snapping/use_gpu_pixel_snap=true environment/default_environment="res://default_env.tres" From 0a1a9b8d358505c153adae56ad274aa1e1a88643 Mon Sep 17 00:00:00 2001 From: tommy-l-ngo Date: Tue, 19 Oct 2021 23:39:04 -0500 Subject: [PATCH 05/13] tidy up title screen Moved titlescreen.gd to scripts folder --- ...ound.png-dbef7fef33c56892772634130111c923.md5 | 3 +++ ...und.png-dbef7fef33c56892772634130111c923.stex | Bin 0 -> 8689 bytes godot_ship/scenes/Title Screen.tscn | 4 ++-- .../title screen}/Title Screen.gd | 0 .../title screen}/Title-Screen-Background.png | Bin .../Title-Screen-Background.png.import | 6 +++--- 6 files changed, 8 insertions(+), 5 deletions(-) create mode 100644 godot_ship/.import/Title-Screen-Background.png-dbef7fef33c56892772634130111c923.md5 create mode 100644 godot_ship/.import/Title-Screen-Background.png-dbef7fef33c56892772634130111c923.stex rename godot_ship/{scenes => script/title screen}/Title Screen.gd (100%) rename godot_ship/{scenes => script/title screen}/Title-Screen-Background.png (100%) rename godot_ship/{scenes => script/title screen}/Title-Screen-Background.png.import (64%) diff --git a/godot_ship/.import/Title-Screen-Background.png-dbef7fef33c56892772634130111c923.md5 b/godot_ship/.import/Title-Screen-Background.png-dbef7fef33c56892772634130111c923.md5 new file mode 100644 index 0000000..65f245f --- /dev/null +++ b/godot_ship/.import/Title-Screen-Background.png-dbef7fef33c56892772634130111c923.md5 @@ -0,0 +1,3 @@ +source_md5="a88d669f1f058a347cc4de2244bac64b" +dest_md5="1073062c6e594eff250036d7489d44a7" + diff --git a/godot_ship/.import/Title-Screen-Background.png-dbef7fef33c56892772634130111c923.stex b/godot_ship/.import/Title-Screen-Background.png-dbef7fef33c56892772634130111c923.stex new file mode 100644 index 0000000000000000000000000000000000000000..1ea8a2a7bec397add7b1da989202550a02af9110 GIT binary patch literal 8689 zcmZvCbzGBQ*!~Pa0Yw^Qlyr?Q2}MN&1V)QA(gyNtH%I6loaUF_4fPB^^^~ zDaiqo?L~b*FZ}%e_Q$r*v(LGobME`Puj@KzkIFq=y}l(?)SHK86 z007ohVGBEXyFz-M^yJbN)d%-<0D$v>0Khr>ODAIh55P0TCm-ivIx2SnNHlN-0AK^C z-c!=^PFiJbjFW^UD1zdF=^0+JhxO^o+XmKar~|C6K<0)`pGb`s5mcthzD<@@NfQ&7V9RbC3p)5rt%(-yuf_W9 zZ`NXcQ1~sk#{SwR?0jNsEk+Bq1S)(~3jOeH48HV)ADhPdO5VS;twatxBds9geB6x} zK$XtD-1)V*NAZJ@AyeiZF;XB;(#!yCGOS_Sz$yXh(phQLCun|Ylm+YeDr(Z|LW zOW+?`(60mdIrJq0&3Ql|)uX_30B}i$e$a+kf7Z$!s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T@&d;w+wuJx_43|}VQ0{r5TB8@z42-pDCB}uRkjix zHVQ&dLG^OCrzZ_fCxN3`pS7Jq6?1tz%Er{MNMY|A`JMLBX>dHG!{2oV(Vxl!JlLYJ z)%tKoGXL`VJozKekTxh|2}6Kh!1_$58^)){H?vRm!L(Qry~)imh$8c6CK2ad!T8qG zUFH97zC+V|vl_}X&14kL*7Tl^ zW=qUKRDg>$g{=?iBTmltdD!Fa_(sWp#K3apV=}1 literal 0 HcmV?d00001 diff --git a/godot_ship/scenes/Title Screen.tscn b/godot_ship/scenes/Title Screen.tscn index f0133f8..83dd5e8 100644 --- a/godot_ship/scenes/Title Screen.tscn +++ b/godot_ship/scenes/Title Screen.tscn @@ -1,7 +1,7 @@ [gd_scene load_steps=3 format=2] -[ext_resource path="res://scenes/Title-Screen-Background.png" type="Texture" id=1] -[ext_resource path="res://scenes/Title Screen.gd" type="Script" id=2] +[ext_resource path="res://script/title screen/Title-Screen-Background.png" type="Texture" id=1] +[ext_resource path="res://script/title screen/Title Screen.gd" type="Script" id=2] [node name="Title Node" type="Control"] anchor_right = 1.0 diff --git a/godot_ship/scenes/Title Screen.gd b/godot_ship/script/title screen/Title Screen.gd similarity index 100% rename from godot_ship/scenes/Title Screen.gd rename to godot_ship/script/title screen/Title Screen.gd diff --git a/godot_ship/scenes/Title-Screen-Background.png b/godot_ship/script/title screen/Title-Screen-Background.png similarity index 100% rename from godot_ship/scenes/Title-Screen-Background.png rename to godot_ship/script/title screen/Title-Screen-Background.png diff --git a/godot_ship/scenes/Title-Screen-Background.png.import b/godot_ship/script/title screen/Title-Screen-Background.png.import similarity index 64% rename from godot_ship/scenes/Title-Screen-Background.png.import rename to godot_ship/script/title screen/Title-Screen-Background.png.import index 61bcece..2fb52fc 100644 --- a/godot_ship/scenes/Title-Screen-Background.png.import +++ b/godot_ship/script/title screen/Title-Screen-Background.png.import @@ -2,15 +2,15 @@ importer="texture" type="StreamTexture" -path="res://.import/Title-Screen-Background.png-0858ea44e9c9235fceac088a9c0f7d28.stex" +path="res://.import/Title-Screen-Background.png-dbef7fef33c56892772634130111c923.stex" metadata={ "vram_texture": false } [deps] -source_file="res://scenes/Title-Screen-Background.png" -dest_files=[ "res://.import/Title-Screen-Background.png-0858ea44e9c9235fceac088a9c0f7d28.stex" ] +source_file="res://script/title screen/Title-Screen-Background.png" +dest_files=[ "res://.import/Title-Screen-Background.png-dbef7fef33c56892772634130111c923.stex" ] [params] From 8d43475a2f451d140c8c4e39038e7a91016627e4 Mon Sep 17 00:00:00 2001 From: tommy-l-ngo Date: Tue, 19 Oct 2021 23:44:26 -0500 Subject: [PATCH 06/13] Update Title Screen.tscn changed button sizing --- godot_ship/scenes/Title Screen.tscn | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/godot_ship/scenes/Title Screen.tscn b/godot_ship/scenes/Title Screen.tscn index 83dd5e8..a309212 100644 --- a/godot_ship/scenes/Title Screen.tscn +++ b/godot_ship/scenes/Title Screen.tscn @@ -17,38 +17,38 @@ texture = ExtResource( 1 ) [node name="VBoxContainer" type="VBoxContainer" parent="."] anchor_left = 0.5 -anchor_top = 1.0 +anchor_top = 0.5 anchor_right = 0.5 -anchor_bottom = 1.0 -margin_left = -46.5 -margin_top = -171.0 -margin_right = 46.5 -margin_bottom = -79.0 +anchor_bottom = 0.5 +margin_left = -68.077 +margin_top = 10.0 +margin_right = 68.077 +margin_bottom = 102.0 __meta__ = { "_edit_use_anchors_": false } [node name="Singleplayer" type="Button" parent="VBoxContainer"] -margin_right = 93.0 +margin_right = 136.0 margin_bottom = 20.0 focus_neighbour_top = NodePath("../Quit") text = "Single Player" [node name="Multiplayer" type="Button" parent="VBoxContainer"] margin_top = 24.0 -margin_right = 93.0 +margin_right = 136.0 margin_bottom = 44.0 text = "Multiplayer" [node name="Options" type="Button" parent="VBoxContainer"] margin_top = 48.0 -margin_right = 93.0 +margin_right = 136.0 margin_bottom = 68.0 text = "Options" [node name="Quit" type="Button" parent="VBoxContainer"] margin_top = 72.0 -margin_right = 93.0 +margin_right = 136.0 margin_bottom = 92.0 focus_neighbour_bottom = NodePath("../Singleplayer") text = "Quit" From dca7099627d6bbcea29179cc7b9660bf36ad26d8 Mon Sep 17 00:00:00 2001 From: hpham474 Date: Wed, 20 Oct 2021 00:33:59 -0500 Subject: [PATCH 07/13] Toggle Options Menu Visibility --- godot_ship/scenes/Main.tscn | 1 + 1 file changed, 1 insertion(+) diff --git a/godot_ship/scenes/Main.tscn b/godot_ship/scenes/Main.tscn index 3dd2b98..e805a24 100644 --- a/godot_ship/scenes/Main.tscn +++ b/godot_ship/scenes/Main.tscn @@ -17,5 +17,6 @@ __meta__ = { [node name="Game" parent="." instance=ExtResource( 2 )] [node name="Options" parent="." instance=ExtResource( 4 )] +visible = false [node name="Debug Menu" parent="." instance=ExtResource( 1 )] From e41231da24c709727193972914609108bd96a074 Mon Sep 17 00:00:00 2001 From: ValliantStorme Date: Wed, 20 Oct 2021 00:40:31 -0500 Subject: [PATCH 08/13] Overhaul menu system --- godot_ship/project.godot | 4 ++ godot_ship/scenes/Main.tscn | 16 ++------ godot_ship/script/debug/debug_menu.gd | 7 +++- godot_ship/script/game/Main.gd | 41 +++++++++++++++++++ godot_ship/script/game/Message Bus.gd | 8 ++++ .../script/title screen/Title Screen.gd | 16 ++++---- 6 files changed, 71 insertions(+), 21 deletions(-) create mode 100644 godot_ship/script/game/Main.gd create mode 100644 godot_ship/script/game/Message Bus.gd diff --git a/godot_ship/project.godot b/godot_ship/project.godot index aa0c1d4..551e31a 100644 --- a/godot_ship/project.godot +++ b/godot_ship/project.godot @@ -14,6 +14,10 @@ config/name="godot_ship" run/main_scene="res://scenes/Main.tscn" config/icon="res://icon.png" +[autoload] + +MessageBus="*res://script/game/Message Bus.gd" + [display] window/size/width=640 diff --git a/godot_ship/scenes/Main.tscn b/godot_ship/scenes/Main.tscn index 3dd2b98..d8abbd4 100644 --- a/godot_ship/scenes/Main.tscn +++ b/godot_ship/scenes/Main.tscn @@ -1,21 +1,11 @@ -[gd_scene load_steps=5 format=2] +[gd_scene load_steps=2 format=2] -[ext_resource path="res://scenes/Debug Menu.tscn" type="PackedScene" id=1] -[ext_resource path="res://scenes/Gameplay.tscn" type="PackedScene" id=2] -[ext_resource path="res://scenes/Title Screen.tscn" type="PackedScene" id=3] -[ext_resource path="res://scenes/Options.tscn" type="PackedScene" id=4] +[ext_resource path="res://script/game/Main.gd" type="Script" id=5] [node name="Root" type="Control"] anchor_right = 1.0 anchor_bottom = 1.0 +script = ExtResource( 5 ) __meta__ = { "_edit_use_anchors_": false } - -[node name="Title Screen" parent="." instance=ExtResource( 3 )] - -[node name="Game" parent="." instance=ExtResource( 2 )] - -[node name="Options" parent="." instance=ExtResource( 4 )] - -[node name="Debug Menu" parent="." instance=ExtResource( 1 )] diff --git a/godot_ship/script/debug/debug_menu.gd b/godot_ship/script/debug/debug_menu.gd index 926cc8d..502ab47 100644 --- a/godot_ship/script/debug/debug_menu.gd +++ b/godot_ship/script/debug/debug_menu.gd @@ -16,7 +16,6 @@ var menu_active = Transform2D(Vector2(1,0), Vector2(0,1), Vector2(0, 0)) func _ready(): debug_canvas = get_node("debug_canvas") debug_transform = debug_canvas.get_transform() - return # Called every frame. 'delta' is the elapsed time since the previous frame. func _process(delta): @@ -33,3 +32,9 @@ func _unhandled_input(event): if event.is_action_pressed("ui_debug"): # open debug menu debug_active = !debug_active; + + + +func _on_LineEdit_text_entered(new_text): + + pass # Replace with function body. diff --git a/godot_ship/script/game/Main.gd b/godot_ship/script/game/Main.gd new file mode 100644 index 0000000..86ee2c2 --- /dev/null +++ b/godot_ship/script/game/Main.gd @@ -0,0 +1,41 @@ +extends Control + +# Scenes +var title_screen +var gameplay +var options +var debug_menu + +var debug_enabled = true + +# Called when the node enters the scene tree for the first time. +func _ready(): + # Connect to signals + MessageBus.connect("change_scene", self, "_on_change_scene") + MessageBus.connect("quit", self, "_on_quit_request") + MessageBus.connect("return_to_title", self, "_on_title_request") + # Create the scenes + title_screen = preload("res://scenes/Title Screen.tscn") + gameplay = preload("res://scenes/Gameplay.tscn") + options = preload("res://scenes/Options.tscn") + debug_menu = preload("res://scenes/Debug Menu.tscn") + if (debug_enabled): + add_child(debug_menu.instance()) + _on_change_scene("Title") + +func _on_change_scene(scene): + match scene: + "Singleplayer": + add_child(gameplay.instance()) + "Multiplayer": + add_child(gameplay.instance()) + "Options": + add_child(options.instance()) + "Title": + add_child(title_screen.instance()) + +func _on_quit_request(): + get_tree().quit() + +func _on_title_request(): + get_tree().change_scene("res://scenes/Options.tscn") diff --git a/godot_ship/script/game/Message Bus.gd b/godot_ship/script/game/Message Bus.gd new file mode 100644 index 0000000..336cc10 --- /dev/null +++ b/godot_ship/script/game/Message Bus.gd @@ -0,0 +1,8 @@ +extends Node + +# Ask for a scene change +signal change_scene(scene_name) +# Ask to quit the game +signal quit +# Ask to return to title screen +signal return_to_title diff --git a/godot_ship/script/title screen/Title Screen.gd b/godot_ship/script/title screen/Title Screen.gd index 51d6f25..cc83a11 100644 --- a/godot_ship/script/title screen/Title Screen.gd +++ b/godot_ship/script/title screen/Title Screen.gd @@ -1,9 +1,7 @@ extends Control -# Declare member variables here. Examples: -# var a = 2 -# var b = "text" +# Declare member variables here: # Called when the node enters the scene tree for the first time. @@ -17,13 +15,17 @@ func _ready(): func _on_Singleplayer_pressed(): - get_tree().change_scene("res://scenes/Gameplay.tscn") + #get_tree().change_scene("res://scenes/Gameplay.tscn") + MessageBus.emit_signal("change_scene", "Singleplayer") func _on_Multiplayer_pressed(): - get_tree().change_scene("res://scenes/Gameplay.tscn") + #get_tree().change_scene("res://scenes/Gameplay.tscn") + MessageBus.emit_signal("change_scene", "Multiplayer") func _on_Options_pressed(): - get_tree().change_scene("res://scenes/Options.tscn") + #get_tree().change_scene("res://scenes/Options.tscn") + MessageBus.emit_signal("change_scene", "Options") func _on_Quit_pressed(): - get_tree().quit() + #get_tree().quit() + MessageBus.emit_signal("quit") From e894ddcce997bddb461a7080b54ed7e79e7c1481 Mon Sep 17 00:00:00 2001 From: ValliantStorme Date: Wed, 20 Oct 2021 01:05:39 -0500 Subject: [PATCH 09/13] Change settings for optimal pixelness --- godot_ship/project.godot | 3 ++- godot_ship/script/debug/debug_menu.gd | 2 +- godot_ship/script/game/Main.gd | 4 ++-- godot_ship/script/game/Message Bus.gd | 1 + godot_ship/script/title screen/Title Screen.gd | 10 ---------- 5 files changed, 6 insertions(+), 14 deletions(-) diff --git a/godot_ship/project.godot b/godot_ship/project.godot index 551e31a..d7f78ee 100644 --- a/godot_ship/project.godot +++ b/godot_ship/project.godot @@ -24,7 +24,7 @@ window/size/width=640 window/size/height=360 window/dpi/allow_hidpi=true window/per_pixel_transparency/allowed=true -window/stretch/mode="2d" +window/stretch/mode="viewport" window/stretch/aspect="keep" [input] @@ -72,3 +72,4 @@ common/enable_pause_aware_picking=true quality/intended_usage/framebuffer_allocation=0 2d/snapping/use_gpu_pixel_snap=true environment/default_environment="res://default_env.tres" +quality/dynamic_fonts/use_oversampling=false diff --git a/godot_ship/script/debug/debug_menu.gd b/godot_ship/script/debug/debug_menu.gd index 502ab47..9d005cd 100644 --- a/godot_ship/script/debug/debug_menu.gd +++ b/godot_ship/script/debug/debug_menu.gd @@ -6,7 +6,7 @@ var debug_transform var debug_active = false var menu_position = 0.0 -var menu_velocity = 2 +var menu_velocity = 4 # positions when the menu is hidden/active var menu_hidden = Transform2D(Vector2(1,0), Vector2(0,1), Vector2(0,-180)) diff --git a/godot_ship/script/game/Main.gd b/godot_ship/script/game/Main.gd index 86ee2c2..7167a73 100644 --- a/godot_ship/script/game/Main.gd +++ b/godot_ship/script/game/Main.gd @@ -19,7 +19,7 @@ func _ready(): gameplay = preload("res://scenes/Gameplay.tscn") options = preload("res://scenes/Options.tscn") debug_menu = preload("res://scenes/Debug Menu.tscn") - if (debug_enabled): + if debug_enabled: add_child(debug_menu.instance()) _on_change_scene("Title") @@ -38,4 +38,4 @@ func _on_quit_request(): get_tree().quit() func _on_title_request(): - get_tree().change_scene("res://scenes/Options.tscn") + get_tree().change_scene("res://scenes/Main.tscn") diff --git a/godot_ship/script/game/Message Bus.gd b/godot_ship/script/game/Message Bus.gd index 336cc10..c179af0 100644 --- a/godot_ship/script/game/Message Bus.gd +++ b/godot_ship/script/game/Message Bus.gd @@ -2,6 +2,7 @@ extends Node # Ask for a scene change signal change_scene(scene_name) +# Ask to kill scene # Ask to quit the game signal quit # Ask to return to title screen diff --git a/godot_ship/script/title screen/Title Screen.gd b/godot_ship/script/title screen/Title Screen.gd index cc83a11..5391fb8 100644 --- a/godot_ship/script/title screen/Title Screen.gd +++ b/godot_ship/script/title screen/Title Screen.gd @@ -8,24 +8,14 @@ extends Control func _ready(): $VBoxContainer/Singleplayer.grab_focus() - -# Called every frame. 'delta' is the elapsed time since the previous frame. -#func _process(delta): -# pass - - func _on_Singleplayer_pressed(): - #get_tree().change_scene("res://scenes/Gameplay.tscn") MessageBus.emit_signal("change_scene", "Singleplayer") func _on_Multiplayer_pressed(): - #get_tree().change_scene("res://scenes/Gameplay.tscn") MessageBus.emit_signal("change_scene", "Multiplayer") func _on_Options_pressed(): - #get_tree().change_scene("res://scenes/Options.tscn") MessageBus.emit_signal("change_scene", "Options") func _on_Quit_pressed(): - #get_tree().quit() MessageBus.emit_signal("quit") From 82501d09b1866044e34ca6b68d75ee7b69125e52 Mon Sep 17 00:00:00 2001 From: ValliantStorme Date: Wed, 20 Oct 2021 02:26:32 -0500 Subject: [PATCH 10/13] Working debug menu! No text output yet. --- godot_ship/scenes/Debug Menu.tscn | 15 ++++++++--- godot_ship/script/debug/debug_menu.gd | 33 +++++++++++++++++++---- godot_ship/script/game/Main.gd | 39 ++++++++++++++++++--------- godot_ship/script/game/Message Bus.gd | 4 +++ 4 files changed, 69 insertions(+), 22 deletions(-) diff --git a/godot_ship/scenes/Debug Menu.tscn b/godot_ship/scenes/Debug Menu.tscn index 649c367..3d235bf 100644 --- a/godot_ship/scenes/Debug Menu.tscn +++ b/godot_ship/scenes/Debug Menu.tscn @@ -22,7 +22,7 @@ transform = Transform2D( 1, 0, 0, 1, 0, -360 ) [node name="VBoxContainer" type="VBoxContainer" parent="debug_canvas"] anchor_right = 1.0 anchor_bottom = 1.0 -margin_bottom = -180.0 +margin_bottom = -190.0 custom_constants/separation = 2 __meta__ = { "_edit_use_anchors_": false @@ -31,13 +31,20 @@ __meta__ = { [node name="TextEdit" type="TextEdit" parent="debug_canvas/VBoxContainer"] margin_right = 640.0 margin_bottom = 144.0 +grow_vertical = 0 rect_min_size = Vector2( 0, 144 ) -text = "Turn 0 -Player 1: 0 ships, 0 hits, 0 misses" +readonly = true +syntax_highlighting = true +fold_gutter = true +wrap_enabled = true +minimap_draw = true [node name="LineEdit" type="LineEdit" parent="debug_canvas/VBoxContainer"] margin_top = 146.0 margin_right = 640.0 margin_bottom = 170.0 -text = ">" +max_length = 256 +placeholder_text = "By your command." caret_blink = true + +[connection signal="text_entered" from="debug_canvas/VBoxContainer/LineEdit" to="." method="_on_LineEdit_text_entered"] diff --git a/godot_ship/script/debug/debug_menu.gd b/godot_ship/script/debug/debug_menu.gd index 9d005cd..dde0a1a 100644 --- a/godot_ship/script/debug/debug_menu.gd +++ b/godot_ship/script/debug/debug_menu.gd @@ -1,6 +1,9 @@ extends Control # Declare member variables here. +var debug_output +var debug_line = 0 + var debug_canvas var debug_transform @@ -9,13 +12,15 @@ var menu_position = 0.0 var menu_velocity = 4 # positions when the menu is hidden/active -var menu_hidden = Transform2D(Vector2(1,0), Vector2(0,1), Vector2(0,-180)) +var menu_hidden = Transform2D(Vector2(1,0), Vector2(0,1), Vector2(0,-170)) var menu_active = Transform2D(Vector2(1,0), Vector2(0,1), Vector2(0, 0)) # Called when the node enters the scene tree for the first time. func _ready(): + debug_canvas = get_node("debug_canvas") debug_transform = debug_canvas.get_transform() + debug_output = get_node("debug_canvas/VBoxContainer/TextEdit") # Called every frame. 'delta' is the elapsed time since the previous frame. func _process(delta): @@ -33,8 +38,26 @@ func _unhandled_input(event): # open debug menu debug_active = !debug_active; +func _on_LineEdit_text_entered(line): + var command = line.split(' ', true, 1) + if command.size() > 0: + print("match ", command) + match command[0]: + "open": + if command.size() > 1: + MessageBus.emit_signal("change_scene", command[1]) + else: + debug_print_line("Usage: open scene") + "kill": + if command.size() > 1: + MessageBus.emit_signal("kill_scene", command[1]) + else: + debug_print_line("Usage: kill scene") + "restart": + MessageBus.emit_signal("return_to_title") + else: + pass - -func _on_LineEdit_text_entered(new_text): - - pass # Replace with function body. +func debug_print_line(string): + debug_output.set_line(debug_line, string) + debug_line += 1 diff --git a/godot_ship/script/game/Main.gd b/godot_ship/script/game/Main.gd index 7167a73..677fb4d 100644 --- a/godot_ship/script/game/Main.gd +++ b/godot_ship/script/game/Main.gd @@ -11,7 +11,8 @@ var debug_enabled = true # Called when the node enters the scene tree for the first time. func _ready(): # Connect to signals - MessageBus.connect("change_scene", self, "_on_change_scene") + MessageBus.connect("change_scene", self, "_on_scene_start") + MessageBus.connect("kill_scene", self, "_on_scene_kill") MessageBus.connect("quit", self, "_on_quit_request") MessageBus.connect("return_to_title", self, "_on_title_request") # Create the scenes @@ -21,21 +22,33 @@ func _ready(): debug_menu = preload("res://scenes/Debug Menu.tscn") if debug_enabled: add_child(debug_menu.instance()) - _on_change_scene("Title") + _on_scene_start("Title") -func _on_change_scene(scene): +# Creates a new instance of each menu scene +func _on_scene_start(scene): + print ("_on_scene_start(",scene,")") match scene: - "Singleplayer": - add_child(gameplay.instance()) - "Multiplayer": - add_child(gameplay.instance()) - "Options": - add_child(options.instance()) - "Title": - add_child(title_screen.instance()) + "Singleplayer": add_child (gameplay.instance()) + "Multiplayer": + add_child (gameplay.instance()) + # add_child (multiplayercontroller.instance()) + "Options": add_child (options.instance()) + "Title": add_child (title_screen.instance()) +# Kills all child nodes with name matching `scene` +func _on_scene_kill(scene): + print ("_on_scene_kill(",scene,")") + var c = get_children() + for i in range (c.size()): + if c[i].name == scene: + c[i].queue_free() + +# Quits func _on_quit_request(): + print ("_on_quit_request()") get_tree().quit() - + +# Kills the current tree and replaces it with a new one func _on_title_request(): - get_tree().change_scene("res://scenes/Main.tscn") + print ("_on_title_request()") + return get_tree().change_scene("res://scenes/Main.tscn") diff --git a/godot_ship/script/game/Message Bus.gd b/godot_ship/script/game/Message Bus.gd index c179af0..981cf82 100644 --- a/godot_ship/script/game/Message Bus.gd +++ b/godot_ship/script/game/Message Bus.gd @@ -3,7 +3,11 @@ extends Node # Ask for a scene change signal change_scene(scene_name) # Ask to kill scene +signal kill_scene(scene_name) # Ask to quit the game signal quit # Ask to return to title screen signal return_to_title + +# Ask to print a string to debug console +signal print_console(string) From b7ba97b1ff372d2b7437cd5f5f5482d8ac36eebc Mon Sep 17 00:00:00 2001 From: ValliantStorme Date: Wed, 20 Oct 2021 03:18:06 -0500 Subject: [PATCH 11/13] Make debug menu fully functional, flesh out command bus. --- godot_ship/scenes/Debug Menu.tscn | 13 +++++++---- godot_ship/script/debug/In.gd | 9 ++++++++ godot_ship/script/debug/LineEdit.gd | 9 ++++++++ godot_ship/script/debug/Out.gd | 10 ++++++++ godot_ship/script/debug/debug_menu.gd | 33 +++++++++++++++++++-------- godot_ship/script/game/Main.gd | 18 +++++++++++---- 6 files changed, 74 insertions(+), 18 deletions(-) create mode 100644 godot_ship/script/debug/In.gd create mode 100644 godot_ship/script/debug/LineEdit.gd create mode 100644 godot_ship/script/debug/Out.gd diff --git a/godot_ship/scenes/Debug Menu.tscn b/godot_ship/scenes/Debug Menu.tscn index 3d235bf..fe579aa 100644 --- a/godot_ship/scenes/Debug Menu.tscn +++ b/godot_ship/scenes/Debug Menu.tscn @@ -1,13 +1,13 @@ -[gd_scene load_steps=3 format=2] +[gd_scene load_steps=5 format=2] [ext_resource path="res://main.tres" type="Theme" id=1] [ext_resource path="res://script/debug/debug_menu.gd" type="Script" id=2] +[ext_resource path="res://script/debug/In.gd" type="Script" id=3] +[ext_resource path="res://script/debug/Out.gd" type="Script" id=4] [node name="Debug" type="Control"] anchor_right = 1.0 anchor_bottom = 1.0 -margin_top = -360.0 -margin_bottom = -360.0 theme = ExtResource( 1 ) script = ExtResource( 2 ) __meta__ = { @@ -16,8 +16,6 @@ __meta__ = { [node name="debug_canvas" type="CanvasLayer" parent="."] layer = 69 -offset = Vector2( 0, -360 ) -transform = Transform2D( 1, 0, 0, 1, 0, -360 ) [node name="VBoxContainer" type="VBoxContainer" parent="debug_canvas"] anchor_right = 1.0 @@ -36,8 +34,10 @@ rect_min_size = Vector2( 0, 144 ) readonly = true syntax_highlighting = true fold_gutter = true +smooth_scrolling = true wrap_enabled = true minimap_draw = true +script = ExtResource( 4 ) [node name="LineEdit" type="LineEdit" parent="debug_canvas/VBoxContainer"] margin_top = 146.0 @@ -46,5 +46,8 @@ margin_bottom = 170.0 max_length = 256 placeholder_text = "By your command." caret_blink = true +script = ExtResource( 3 ) +[connection signal="clear_line" from="." to="debug_canvas/VBoxContainer/LineEdit" method="_on_Debug_clear_line"] +[connection signal="print_text" from="." to="debug_canvas/VBoxContainer/TextEdit" method="_on_Debug_print_text"] [connection signal="text_entered" from="debug_canvas/VBoxContainer/LineEdit" to="." method="_on_LineEdit_text_entered"] diff --git a/godot_ship/script/debug/In.gd b/godot_ship/script/debug/In.gd new file mode 100644 index 0000000..efdca27 --- /dev/null +++ b/godot_ship/script/debug/In.gd @@ -0,0 +1,9 @@ +extends LineEdit + + +# Declare member variables here. Examples: +# var a = 2 +# var b = "text" + +func _on_Debug_clear_line(): + clear() diff --git a/godot_ship/script/debug/LineEdit.gd b/godot_ship/script/debug/LineEdit.gd new file mode 100644 index 0000000..efdca27 --- /dev/null +++ b/godot_ship/script/debug/LineEdit.gd @@ -0,0 +1,9 @@ +extends LineEdit + + +# Declare member variables here. Examples: +# var a = 2 +# var b = "text" + +func _on_Debug_clear_line(): + clear() diff --git a/godot_ship/script/debug/Out.gd b/godot_ship/script/debug/Out.gd new file mode 100644 index 0000000..90681a6 --- /dev/null +++ b/godot_ship/script/debug/Out.gd @@ -0,0 +1,10 @@ +extends TextEdit + +# Called when the node enters the scene tree for the first time. +func _ready(): + MessageBus.connect("print_console", self, "_on_Debug_print_text") + pass # Replace with function body. + + +func _on_Debug_print_text(text): + insert_text_at_cursor(text) diff --git a/godot_ship/script/debug/debug_menu.gd b/godot_ship/script/debug/debug_menu.gd index dde0a1a..9f14b13 100644 --- a/godot_ship/script/debug/debug_menu.gd +++ b/godot_ship/script/debug/debug_menu.gd @@ -15,6 +15,10 @@ var menu_velocity = 4 var menu_hidden = Transform2D(Vector2(1,0), Vector2(0,1), Vector2(0,-170)) var menu_active = Transform2D(Vector2(1,0), Vector2(0,1), Vector2(0, 0)) +# signals +signal clear_line +signal print_text(text) + # Called when the node enters the scene tree for the first time. func _ready(): @@ -33,31 +37,42 @@ func _process(delta): debug_canvas.set_transform(menu_hidden.interpolate_with(menu_active, menu_position)) -func _unhandled_input(event): +func _input(event): if event.is_action_pressed("ui_debug"): # open debug menu debug_active = !debug_active; func _on_LineEdit_text_entered(line): + emit_signal("clear_line") + debug_print_line("") var command = line.split(' ', true, 1) if command.size() > 0: - print("match ", command) match command[0]: - "open": + "start": if command.size() > 1: MessageBus.emit_signal("change_scene", command[1]) + debug_print_line("start '" + command[1] + "'\n".c_unescape()) else: - debug_print_line("Usage: open scene") + debug_print_line("Usage: start scene") "kill": - if command.size() > 1: + if command.size() > 1 and command[1] != "Debug": MessageBus.emit_signal("kill_scene", command[1]) + debug_print_line("kill '" + command[1] + "'\n".c_unescape()) else: debug_print_line("Usage: kill scene") "restart": MessageBus.emit_signal("return_to_title") - else: - pass + "print": + if command.size() > 1: + debug_print_line(command[1].c_unescape()) + "raw_emit": + var mbus_signal = command[1].split(' ', true, 1) + match mbus_signal.size(): + 2: MessageBus.emit_signal(mbus_signal[0], mbus_signal[1]) + 1: MessageBus.emit_signal(mbus_signal[0]) + 0: debug_print_line( "Usage: raw_emit signal [value]\n") + _: + debug_print_line("BY YOUR COMMAND.\n") func debug_print_line(string): - debug_output.set_line(debug_line, string) - debug_line += 1 + emit_signal("print_text", string.c_unescape()) diff --git a/godot_ship/script/game/Main.gd b/godot_ship/script/game/Main.gd index 677fb4d..e98fe09 100644 --- a/godot_ship/script/game/Main.gd +++ b/godot_ship/script/game/Main.gd @@ -28,12 +28,20 @@ func _ready(): func _on_scene_start(scene): print ("_on_scene_start(",scene,")") match scene: - "Singleplayer": add_child (gameplay.instance()) - "Multiplayer": + "Singleplayer": + add_child (gameplay.instance()) + return true + "Multiplayer": add_child (gameplay.instance()) # add_child (multiplayercontroller.instance()) - "Options": add_child (options.instance()) - "Title": add_child (title_screen.instance()) + return true + "Options": + add_child (options.instance()) + return true + "Title": + add_child (title_screen.instance()) + return true + # Kills all child nodes with name matching `scene` func _on_scene_kill(scene): @@ -42,6 +50,8 @@ func _on_scene_kill(scene): for i in range (c.size()): if c[i].name == scene: c[i].queue_free() + return true + return false # Quits func _on_quit_request(): From 2d1ada25883b91202019e0347ebf5d5e90811b3a Mon Sep 17 00:00:00 2001 From: ValliantStorme Date: Wed, 20 Oct 2021 05:13:24 -0500 Subject: [PATCH 12/13] Add help text to debug menu --- godot_ship/scenes/Debug Menu.tscn | 3 +- godot_ship/script/debug/In.gd | 2 +- godot_ship/script/debug/LineEdit.gd | 9 -- godot_ship/script/debug/Out.gd | 6 ++ godot_ship/script/debug/debug_menu.gd | 135 ++++++++++++++++++++------ godot_ship/script/game/Main.gd | 23 +++-- godot_ship/script/game/Message Bus.gd | 7 ++ 7 files changed, 139 insertions(+), 46 deletions(-) delete mode 100644 godot_ship/script/debug/LineEdit.gd diff --git a/godot_ship/scenes/Debug Menu.tscn b/godot_ship/scenes/Debug Menu.tscn index fe579aa..94d219a 100644 --- a/godot_ship/scenes/Debug Menu.tscn +++ b/godot_ship/scenes/Debug Menu.tscn @@ -48,6 +48,7 @@ placeholder_text = "By your command." caret_blink = true script = ExtResource( 3 ) -[connection signal="clear_line" from="." to="debug_canvas/VBoxContainer/LineEdit" method="_on_Debug_clear_line"] +[connection signal="clear_in" from="." to="debug_canvas/VBoxContainer/LineEdit" method="_on_Debug_clear_in"] +[connection signal="clear_out" from="." to="debug_canvas/VBoxContainer/TextEdit" method="_on_Debug_clear_out"] [connection signal="print_text" from="." to="debug_canvas/VBoxContainer/TextEdit" method="_on_Debug_print_text"] [connection signal="text_entered" from="debug_canvas/VBoxContainer/LineEdit" to="." method="_on_LineEdit_text_entered"] diff --git a/godot_ship/script/debug/In.gd b/godot_ship/script/debug/In.gd index efdca27..3e76043 100644 --- a/godot_ship/script/debug/In.gd +++ b/godot_ship/script/debug/In.gd @@ -5,5 +5,5 @@ extends LineEdit # var a = 2 # var b = "text" -func _on_Debug_clear_line(): +func _on_Debug_clear_in(): clear() diff --git a/godot_ship/script/debug/LineEdit.gd b/godot_ship/script/debug/LineEdit.gd deleted file mode 100644 index efdca27..0000000 --- a/godot_ship/script/debug/LineEdit.gd +++ /dev/null @@ -1,9 +0,0 @@ -extends LineEdit - - -# Declare member variables here. Examples: -# var a = 2 -# var b = "text" - -func _on_Debug_clear_line(): - clear() diff --git a/godot_ship/script/debug/Out.gd b/godot_ship/script/debug/Out.gd index 90681a6..fdf79f2 100644 --- a/godot_ship/script/debug/Out.gd +++ b/godot_ship/script/debug/Out.gd @@ -8,3 +8,9 @@ func _ready(): func _on_Debug_print_text(text): insert_text_at_cursor(text) + + +func _on_Debug_clear_out(): + cursor_set_line(0) + cursor_set_column(0) + text = ""; diff --git a/godot_ship/script/debug/debug_menu.gd b/godot_ship/script/debug/debug_menu.gd index 9f14b13..149439f 100644 --- a/godot_ship/script/debug/debug_menu.gd +++ b/godot_ship/script/debug/debug_menu.gd @@ -16,7 +16,8 @@ var menu_hidden = Transform2D(Vector2(1,0), Vector2(0,1), Vector2(0,-170)) var menu_active = Transform2D(Vector2(1,0), Vector2(0,1), Vector2(0, 0)) # signals -signal clear_line +signal clear_in +signal clear_out signal print_text(text) # Called when the node enters the scene tree for the first time. @@ -43,36 +44,112 @@ func _input(event): debug_active = !debug_active; func _on_LineEdit_text_entered(line): - emit_signal("clear_line") + emit_signal("clear_in") debug_print_line("") var command = line.split(' ', true, 1) - if command.size() > 0: - match command[0]: - "start": - if command.size() > 1: - MessageBus.emit_signal("change_scene", command[1]) - debug_print_line("start '" + command[1] + "'\n".c_unescape()) - else: - debug_print_line("Usage: start scene") - "kill": - if command.size() > 1 and command[1] != "Debug": - MessageBus.emit_signal("kill_scene", command[1]) - debug_print_line("kill '" + command[1] + "'\n".c_unescape()) - else: - debug_print_line("Usage: kill scene") - "restart": - MessageBus.emit_signal("return_to_title") - "print": - if command.size() > 1: - debug_print_line(command[1].c_unescape()) - "raw_emit": - var mbus_signal = command[1].split(' ', true, 1) - match mbus_signal.size(): - 2: MessageBus.emit_signal(mbus_signal[0], mbus_signal[1]) - 1: MessageBus.emit_signal(mbus_signal[0]) - 0: debug_print_line( "Usage: raw_emit signal [value]\n") - _: - debug_print_line("BY YOUR COMMAND.\n") + match command[0]: + "start", "s": + command_start(command) + "stop", "kill", "k": + command_stop(command) + "list", "ls", "l": + command_list(command) + "restart", "killall": + command_restart(command) + "print", "p": + command_print(command) + "raw_emit", "emit", "r", "e": # Send a signal over the MessageBus + command_emit(command) + "clear","cls": # Clear the output + command_clear(command) + "help", "h": + command_help(command) + _: + debug_print_line("Command not recognized.\n") func debug_print_line(string): emit_signal("print_text", string.c_unescape()) + +# Commands + +# start: Loads scene from res://scenes/*.tscn by filename, and starts it +func command_start (command): + if command.size() > 1: + MessageBus.emit_signal("start_tcsn", command[1]) + debug_print_line("start '" + command[1] + "'\n") + else: + debug_print_line("Usage: start scene") + +# stop: Stops scene by name of root node. +func command_stop (command): + if command.size() > 1 and command[1] != "Debug": + MessageBus.emit_signal("kill_scene", command[1]) + debug_print_line("kill '" + command[1] + "'\n") + else: + debug_print_line("Usage: kill scene") + +# list: Lists names of active scenes (children of Root) +func command_list (command): + debug_print_line("list: ") + MessageBus.emit_signal("list_scenes") + +# restart: Kills the current tree and replants Root +func command_restart (command): + MessageBus.emit_signal("return_to_title") + +# print: prints a message to the in-game debug console +func command_print(command): + if command.size() > 1: + debug_print_line(command[1] + "\n") + +# emit: emits a message onto the MessageBus (!Extremely Danger!) +func command_emit (command): + var mbus_signal = command[1].split(' ', true, 1) + match mbus_signal.size(): + 2: + debug_print_line("Message: " + String(mbus_signal) + "\n") + MessageBus.emit_signal(mbus_signal[0], mbus_signal[1]) + 1: + debug_print_line("Message: " + String(mbus_signal) + "\n") + MessageBus.emit_signal(mbus_signal[0]) + 0: debug_print_line( "Usage: raw_emit signal [value]\n") + +# clear: clears the debug output +func command_clear (command): + emit_signal("clear_out"); + +# help: Prints help dialogue +func command_help (command): + if (command.size() == 1): + debug_print_line("Ship's Commander V0.1\n") + debug_print_line("Valid commands:\nstart, stop, list, restart, print, emit, clear, help\n") + else: + debug_print_line(command[1]) + match command[1]: + "start", "s": + debug_print_line(" filename\nAliases: 'start', 's'\n") + debug_print_line("Loads and runs the scene filename.tscn\n") + "stop", "kill", "k": + debug_print_line(" scene\nAliases: 'stop', 'kill', 'k'\n") + debug_print_line("Kills an active scene whose name matches node.\n") + "list", "ls", "l": + debug_print_line("\nAliases: 'list', 'ls', 'l'\n") + debug_print_line("Lists the currently active scenes\n") + "restart", "killall": + debug_print_line("\nAliases: 'restart', 'killall'\n") + debug_print_line("Kills the current scene tree and plants a new Root.\n") + "print", "p": + debug_print_line(" string\nAliases: 'print', 'p'\n") + debug_print_line("Prints a string to the in-game debug console\n") + "raw_emit", "emit", "r", "e": + debug_print_line(" signal [message]\nAliases: 'raw_emit', 'emit', 'r', 'e'\n") + debug_print_line("Puts a message on the MessageBus without validation.\n") + "clear","cls": + debug_print_line("\nAliases: 'clear', 'cls'\n") + debug_print_line("Clears the debug output.\n") + "help", "h": + debug_print_line(" [command]\nAliases: 'help', 'h'\n") + debug_print_line("Prints information about a command.\n") + _: + debug_print_line(command[1] + "\nIsn't a valid command\n") + debug_print_line("\n") diff --git a/godot_ship/script/game/Main.gd b/godot_ship/script/game/Main.gd index e98fe09..df62d73 100644 --- a/godot_ship/script/game/Main.gd +++ b/godot_ship/script/game/Main.gd @@ -11,9 +11,11 @@ var debug_enabled = true # Called when the node enters the scene tree for the first time. func _ready(): # Connect to signals + MessageBus.connect("start_tcsn", self, "_on_scene_start_by_name") MessageBus.connect("change_scene", self, "_on_scene_start") - MessageBus.connect("kill_scene", self, "_on_scene_kill") - MessageBus.connect("quit", self, "_on_quit_request") + MessageBus.connect("kill_scene", self, "_on_scene_kill") + MessageBus.connect("list_scenes", self, "_on_scene_list") + MessageBus.connect("quit", self, "_on_quit_request") MessageBus.connect("return_to_title", self, "_on_title_request") # Create the scenes title_screen = preload("res://scenes/Title Screen.tscn") @@ -41,24 +43,33 @@ func _on_scene_start(scene): "Title": add_child (title_screen.instance()) return true - + +func _on_scene_start_by_name(scene): + var pack = load("res://scenes/" + scene + ".tscn"); + add_child(pack.instance()); # Kills all child nodes with name matching `scene` func _on_scene_kill(scene): - print ("_on_scene_kill(",scene,")") var c = get_children() for i in range (c.size()): if c[i].name == scene: c[i].queue_free() + MessageBus.emit_signal("print_console", String(c[i].name) + " killed.\n".c_unescape()) return true return false +func _on_scene_list(): + var children = get_children() + var names = [] + for i in range (children.size()): + names.append(children[i].name) + MessageBus.emit_signal("print_console", String(names) + "\n".c_unescape()) + + # Quits func _on_quit_request(): - print ("_on_quit_request()") get_tree().quit() # Kills the current tree and replaces it with a new one func _on_title_request(): - print ("_on_title_request()") return get_tree().change_scene("res://scenes/Main.tscn") diff --git a/godot_ship/script/game/Message Bus.gd b/godot_ship/script/game/Message Bus.gd index 981cf82..334ac6b 100644 --- a/godot_ship/script/game/Message Bus.gd +++ b/godot_ship/script/game/Message Bus.gd @@ -1,9 +1,16 @@ extends Node +# Ignore "unused signal" warnings in this class +# warning-ignore-all:unused_signal + # Ask for a scene change signal change_scene(scene_name) + +signal start_tcsn(scene_tcsn_name) # Ask to kill scene signal kill_scene(scene_name) +# Ask to list active scenes +signal list_scenes() # Ask to quit the game signal quit # Ask to return to title screen From 5e82efbe4c4fda3696b8e0a7e9874d07e61b8aa1 Mon Sep 17 00:00:00 2001 From: ValliantStorme Date: Wed, 20 Oct 2021 06:00:09 -0500 Subject: [PATCH 13/13] Finish debug menu for the night. --- godot_ship/script/debug/Out.gd | 2 +- godot_ship/script/debug/debug_menu.gd | 37 ++++++++++++++++++--------- godot_ship/script/game/Main.gd | 13 +++++----- 3 files changed, 33 insertions(+), 19 deletions(-) diff --git a/godot_ship/script/debug/Out.gd b/godot_ship/script/debug/Out.gd index fdf79f2..7b1298f 100644 --- a/godot_ship/script/debug/Out.gd +++ b/godot_ship/script/debug/Out.gd @@ -2,7 +2,7 @@ extends TextEdit # Called when the node enters the scene tree for the first time. func _ready(): - MessageBus.connect("print_console", self, "_on_Debug_print_text") + var _errno = MessageBus.connect("print_console", self, "_on_Debug_print_text") pass # Replace with function body. diff --git a/godot_ship/script/debug/debug_menu.gd b/godot_ship/script/debug/debug_menu.gd index 149439f..a928c56 100644 --- a/godot_ship/script/debug/debug_menu.gd +++ b/godot_ship/script/debug/debug_menu.gd @@ -16,23 +16,28 @@ var menu_hidden = Transform2D(Vector2(1,0), Vector2(0,1), Vector2(0,-170)) var menu_active = Transform2D(Vector2(1,0), Vector2(0,1), Vector2(0, 0)) # signals -signal clear_in -signal clear_out -signal print_text(text) +signal clear_in # clears the debug input +signal clear_out # clears the debug output +signal print_text(text) # Sends text for printing to the Out buffer # Called when the node enters the scene tree for the first time. func _ready(): - debug_canvas = get_node("debug_canvas") debug_transform = debug_canvas.get_transform() debug_output = get_node("debug_canvas/VBoxContainer/TextEdit") + command_help([""]) # Called every frame. 'delta' is the elapsed time since the previous frame. func _process(delta): if (debug_active && menu_position < 1): + # Move the menu down menu_position += menu_velocity * delta; + $debug_canvas/VBoxContainer/LineEdit.grab_focus() elif (!debug_active && menu_position > 0): + # Move the menu up menu_position -= menu_velocity * delta; + # Clear the input box + emit_signal("clear_in") else: menu_position = round(menu_position) @@ -42,6 +47,8 @@ func _input(event): if event.is_action_pressed("ui_debug"): # open debug menu debug_active = !debug_active; + # Hand the keyboard focus to the next valid focus + if (!debug_active): find_next_valid_focus().grab_focus() func _on_LineEdit_text_entered(line): emit_signal("clear_in") @@ -82,19 +89,22 @@ func command_start (command): # stop: Stops scene by name of root node. func command_stop (command): - if command.size() > 1 and command[1] != "Debug": - MessageBus.emit_signal("kill_scene", command[1]) - debug_print_line("kill '" + command[1] + "'\n") + if command.size() > 1: + if command[1] != "Debug": + debug_print_line("kill '" + command[1] + "'\n") + MessageBus.emit_signal("kill_scene", command[1]) + else: + debug_print_line("YOU DIDN'T SAY THE MAGIC WORD!\n") else: debug_print_line("Usage: kill scene") # list: Lists names of active scenes (children of Root) -func command_list (command): +func command_list (_command): debug_print_line("list: ") MessageBus.emit_signal("list_scenes") # restart: Kills the current tree and replants Root -func command_restart (command): +func command_restart (_command): MessageBus.emit_signal("return_to_title") # print: prints a message to the in-game debug console @@ -115,13 +125,16 @@ func command_emit (command): 0: debug_print_line( "Usage: raw_emit signal [value]\n") # clear: clears the debug output -func command_clear (command): +func command_clear (_command): emit_signal("clear_out"); +func command_tree (_command): + pass + # help: Prints help dialogue func command_help (command): if (command.size() == 1): - debug_print_line("Ship's Commander V0.1\n") + debug_print_line("Ship's Commander V 0.1\n") debug_print_line("Valid commands:\nstart, stop, list, restart, print, emit, clear, help\n") else: debug_print_line(command[1]) @@ -152,4 +165,4 @@ func command_help (command): debug_print_line("Prints information about a command.\n") _: debug_print_line(command[1] + "\nIsn't a valid command\n") - debug_print_line("\n") + debug_print_line("\n") diff --git a/godot_ship/script/game/Main.gd b/godot_ship/script/game/Main.gd index df62d73..42c8c42 100644 --- a/godot_ship/script/game/Main.gd +++ b/godot_ship/script/game/Main.gd @@ -11,12 +11,13 @@ var debug_enabled = true # Called when the node enters the scene tree for the first time. func _ready(): # Connect to signals - MessageBus.connect("start_tcsn", self, "_on_scene_start_by_name") - MessageBus.connect("change_scene", self, "_on_scene_start") - MessageBus.connect("kill_scene", self, "_on_scene_kill") - MessageBus.connect("list_scenes", self, "_on_scene_list") - MessageBus.connect("quit", self, "_on_quit_request") - MessageBus.connect("return_to_title", self, "_on_title_request") + var _errno = 0; + _errno += MessageBus.connect("start_tcsn", self, "_on_scene_start_by_name") + _errno += MessageBus.connect("change_scene", self, "_on_scene_start") + _errno += MessageBus.connect("kill_scene", self, "_on_scene_kill") + _errno += MessageBus.connect("list_scenes", self, "_on_scene_list") + _errno += MessageBus.connect("quit", self, "_on_quit_request") + _errno += MessageBus.connect("return_to_title", self, "_on_title_request") # Create the scenes title_screen = preload("res://scenes/Title Screen.tscn") gameplay = preload("res://scenes/Gameplay.tscn")