From f801b82abe7fb329fa1150c5826c191cda5f6b16 Mon Sep 17 00:00:00 2001 From: Anthony Wilcox <35226681+tomiscw@users.noreply.github.com> Date: Wed, 9 Jan 2019 21:17:39 -0500 Subject: [PATCH] Working title and game screen - Added local translations - Added functionality to the title and game screens - Fixed a few overlooked things --- README.md | 2 +- project/lang/local.csv | 14 ++++ project/lang/local.csv.import | 16 +++++ project/lang/local.en.translation | Bin 0 -> 852 bytes project/lang/local.sv.translation | Bin 0 -> 868 bytes project/project.godot | 8 ++- project/scn/GameScn.tscn | 12 ++++ project/scn/TitleScn.tscn | 105 +++++++++++++++++++++++++++++- project/scn/WinDialogs.tscn | 40 ++++++------ project/src/GameKit.gd | 4 +- project/src/GameScn.gd | 6 ++ project/src/TitleScn.gd | 10 +++ 12 files changed, 189 insertions(+), 28 deletions(-) create mode 100644 project/lang/local.csv create mode 100644 project/lang/local.csv.import create mode 100644 project/lang/local.en.translation create mode 100644 project/lang/local.sv.translation create mode 100644 project/scn/GameScn.tscn create mode 100644 project/src/GameScn.gd create mode 100644 project/src/TitleScn.gd diff --git a/README.md b/README.md index 5c24276..4da1c97 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,3 @@ # Anthony's Godot Template -This is my own basic Godot template. It features a empty title screen with a few pre-made window dialogs. \ No newline at end of file +This is my own general purpose Godot template based on Nathan's Dress Up. It features a empty title screen with a few pre-made window dialogs. \ No newline at end of file diff --git a/project/lang/local.csv b/project/lang/local.csv new file mode 100644 index 0000000..c544972 --- /dev/null +++ b/project/lang/local.csv @@ -0,0 +1,14 @@ +,en,sv +KENG,English,Engelsk +KSWD,Swedish,Svenska +KRUS,Resume,Återuppta +KPUS,Paused,Pausad +KPLY,Play,Spela +KCRE,Credits,Eftertexter +KABO,About,Handla om +KLIC,License,Licens +KSOO,Coming Soon,Kommer snart +KEXT,Exit,Utgång +KHELP,Help,Hjälp +KSET,Settings,Inställningar +KLANG,Languages,Språk \ No newline at end of file diff --git a/project/lang/local.csv.import b/project/lang/local.csv.import new file mode 100644 index 0000000..beece0d --- /dev/null +++ b/project/lang/local.csv.import @@ -0,0 +1,16 @@ +[remap] + +importer="csv_translation" +type="Translation" + +[deps] + +files=[ "res://lang/local.en.translation", "res://lang/local.sv.translation" ] + +source_file="res://lang/local.csv" +dest_files=[ "res://lang/local.en.translation", "res://lang/local.sv.translation" ] + +[params] + +compress=true +delimiter=0 diff --git a/project/lang/local.en.translation b/project/lang/local.en.translation new file mode 100644 index 0000000000000000000000000000000000000000..83193381c2b8ecadf601c123a7cd54b654f7f317 GIT binary patch literal 852 zcmbVLze^lJ6n-%|^UDYkK_LOX6kaOLp%9P*qn9%x2a!8LNwd!FJ?<9QUD=sMV{2tC zSmh7MACM*l(pgxhNM~gsY9m+)fz|J=vv9~&dGPVg_sz_kH*aTa^;(&1JnZ0?7%wd- z-CmAVpnYY$Fv!;ZH$TD7VIX21#*xd8AG*qSOz3Er1E&7Yxj=0&J%zKuTB{aodJK{7 zV0w;W8`U{RHGHNQkd4?~XJZXHNt?(ET6f#D8+n@sCeZ`n8IWe0o|q_7pIC^lcg|s= z2Y4eZ5Yi;^ggKx`piy85kmv>afEybF7{Bh&lIE?|lp7aDeuoyQtur}sJ_L`beFHbQaOS!n(Ay!`q*mtpKby5T%~CM literal 0 HcmV?d00001 diff --git a/project/lang/local.sv.translation b/project/lang/local.sv.translation new file mode 100644 index 0000000000000000000000000000000000000000..f64ee2a3cb2d68d34f75d802eacdb444cfca1b73 GIT binary patch literal 868 zcmbVLze^lJ6n^G%F=sTQg<3?^fL;oJAXv$PhUCl{1?5gbY>sgq*7e5SWoJ%;y@hok zSXe6L4@hAMgus#_Wr}pEQiNzDScL>uzo$Fl2v$D$_~w1{-kW)EXUmoHGfFMfz#UjG zmW19|iiEF~Fkax>xLfmmWcC1&)ImLRWK{)@P*oFDwIh8=4;%MqiYfmwA%}T%9#&fMcAOPk)yfjUv&G=A-RPMTFtfO7BUG{wo#}i5F`~gio?gnKgS6r Uv!5~-P4VG=Ze}4ND&zmU1l{PcdH?_b literal 0 HcmV?d00001 diff --git a/project/project.godot b/project/project.godot index 2f42b1f..be2eef3 100644 --- a/project/project.godot +++ b/project/project.godot @@ -11,12 +11,12 @@ config_version=3 [application] config/name="Anthony's Godot Template" -run/main_scene="res://scenes/TitleScn.tscn" +run/main_scene="res://scn/TitleScn.tscn" [autoload] -WinDialogs="*res://scenes/WinDialogs.tscn" GameKit="*res://src/GameKit.gd" +WinDialogs="*res://scn/WinDialogs.tscn" [display] @@ -27,3 +27,7 @@ window/size/resizable=false ui_pause=[ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777217,"unicode":0,"echo":false,"script":null) , Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":11,"pressure":0.0,"pressed":false,"script":null) ] + +[locale] + +translations=PoolStringArray( "res://lang/local.en.translation", "res://lang/local.sv.translation" ) diff --git a/project/scn/GameScn.tscn b/project/scn/GameScn.tscn new file mode 100644 index 0000000..8360ca7 --- /dev/null +++ b/project/scn/GameScn.tscn @@ -0,0 +1,12 @@ +[gd_scene load_steps=3 format=2] + +[ext_resource path="res://src/GameScn.gd" type="Script" id=1] +[ext_resource path="res://scn/WinDialogs.tscn" type="PackedScene" id=2] + +[node name="GameScn" type="Node"] + +script = ExtResource( 1 ) + +[node name="WinDialogs" parent="." index="0" instance=ExtResource( 2 )] + + diff --git a/project/scn/TitleScn.tscn b/project/scn/TitleScn.tscn index 0383134..387293e 100644 --- a/project/scn/TitleScn.tscn +++ b/project/scn/TitleScn.tscn @@ -1,9 +1,108 @@ -[gd_scene load_steps=2 format=2] +[gd_scene load_steps=3 format=2] -[ext_resource path="res://scn/WinDialogs.tscn" type="PackedScene" id=1] +[ext_resource path="res://src/TitleScn.gd" type="Script" id=1] +[ext_resource path="res://scn/WinDialogs.tscn" type="PackedScene" id=2] [node name="TitleScn" type="Node" index="0"] -[node name="WinDialogs" parent="." index="0" instance=ExtResource( 1 )] +script = ExtResource( 1 ) + +[node name="TitleVBox" type="VBoxContainer" parent="." index="0"] + +anchor_left = 0.0 +anchor_top = 0.0 +anchor_right = 0.0 +anchor_bottom = 0.0 +margin_left = 428.0 +margin_top = 244.0 +margin_right = 575.0 +margin_bottom = 380.0 +rect_pivot_offset = Vector2( 0, 0 ) +rect_clip_content = false +mouse_filter = 1 +mouse_default_cursor_shape = 0 +size_flags_horizontal = 1 +size_flags_vertical = 1 +alignment = 0 + +[node name="PlayBtn" type="Button" parent="TitleVBox" index="0"] + +anchor_left = 0.0 +anchor_top = 0.0 +anchor_right = 0.0 +anchor_bottom = 0.0 +margin_right = 147.0 +margin_bottom = 20.0 +rect_pivot_offset = Vector2( 0, 0 ) +rect_clip_content = false +focus_mode = 2 +mouse_filter = 0 +mouse_default_cursor_shape = 0 +size_flags_horizontal = 1 +size_flags_vertical = 1 +toggle_mode = false +enabled_focus_mode = 2 +shortcut = null +group = null +text = "KPLY" +flat = false +align = 1 +_sections_unfolded = [ "Rect" ] + +[node name="CreditsBtn" type="Button" parent="TitleVBox" index="1"] + +anchor_left = 0.0 +anchor_top = 0.0 +anchor_right = 0.0 +anchor_bottom = 0.0 +margin_top = 24.0 +margin_right = 147.0 +margin_bottom = 44.0 +rect_pivot_offset = Vector2( 0, 0 ) +rect_clip_content = false +focus_mode = 2 +mouse_filter = 0 +mouse_default_cursor_shape = 0 +size_flags_horizontal = 1 +size_flags_vertical = 1 +toggle_mode = false +enabled_focus_mode = 2 +shortcut = null +group = null +text = "KCRE" +flat = false +align = 1 + +[node name="LicenseBtn" type="Button" parent="TitleVBox" index="2"] + +anchor_left = 0.0 +anchor_top = 0.0 +anchor_right = 0.0 +anchor_bottom = 0.0 +margin_top = 48.0 +margin_right = 147.0 +margin_bottom = 68.0 +rect_pivot_offset = Vector2( 0, 0 ) +rect_clip_content = false +focus_mode = 2 +mouse_filter = 0 +mouse_default_cursor_shape = 0 +size_flags_horizontal = 1 +size_flags_vertical = 1 +toggle_mode = false +enabled_focus_mode = 2 +shortcut = null +group = null +text = "KLIC" +flat = false +align = 1 + +[node name="WinDialogs" parent="." index="1" instance=ExtResource( 2 )] + +[connection signal="pressed" from="TitleVBox/PlayBtn" to="." method="_on_PlayBtn_pressed"] + +[connection signal="pressed" from="TitleVBox/CreditsBtn" to="." method="_on_CreditsBtn_pressed"] + +[connection signal="pressed" from="TitleVBox/LicenseBtn" to="." method="_on_LicenseBtn_pressed"] diff --git a/project/scn/WinDialogs.tscn b/project/scn/WinDialogs.tscn index a3dd3fa..8bb47f5 100644 --- a/project/scn/WinDialogs.tscn +++ b/project/scn/WinDialogs.tscn @@ -19,16 +19,14 @@ script = ExtResource( 1 ) [node name="PauseWin" type="PopupDialog" parent="." index="0"] pause_mode = 2 -editor/display_folded = true -visible = false anchor_left = 0.0 anchor_top = 0.0 anchor_right = 0.0 anchor_bottom = 0.0 -margin_left = 318.0 -margin_top = 227.0 -margin_right = 494.0 -margin_bottom = 341.0 +margin_left = 430.0 +margin_top = 200.0 +margin_right = 606.0 +margin_bottom = 314.0 rect_pivot_offset = Vector2( 0, 0 ) rect_clip_content = false mouse_filter = 0 @@ -36,7 +34,7 @@ mouse_default_cursor_shape = 0 size_flags_horizontal = 1 size_flags_vertical = 1 popup_exclusive = false -_sections_unfolded = [ "Pause" ] +_sections_unfolded = [ "Pause", "Rect" ] [node name="PauseVbox" type="VBoxContainer" parent="PauseWin" index="0"] @@ -156,10 +154,10 @@ anchor_left = 0.0 anchor_top = 0.0 anchor_right = 0.0 anchor_bottom = 0.0 -margin_left = 260.0 -margin_top = 132.0 -margin_right = 608.0 -margin_bottom = 399.0 +margin_left = 404.0 +margin_top = 158.0 +margin_right = 752.0 +margin_bottom = 425.0 rect_pivot_offset = Vector2( 0, 0 ) rect_clip_content = false mouse_filter = 0 @@ -214,10 +212,10 @@ anchor_left = 0.0 anchor_top = 0.0 anchor_right = 0.0 anchor_bottom = 0.0 -margin_left = 320.0 -margin_top = 211.0 -margin_right = 472.0 -margin_bottom = 279.0 +margin_left = 504.0 +margin_top = 264.0 +margin_right = 656.0 +margin_bottom = 332.0 rect_pivot_offset = Vector2( 0, 0 ) rect_clip_content = false mouse_filter = 0 @@ -255,10 +253,10 @@ anchor_left = 0.0 anchor_top = 0.0 anchor_right = 0.0 anchor_bottom = 0.0 -margin_left = 209.0 -margin_top = 129.0 -margin_right = 613.0 -margin_bottom = 404.0 +margin_left = 278.0 +margin_top = 159.0 +margin_right = 745.0 +margin_bottom = 431.0 rect_pivot_offset = Vector2( 0, 0 ) rect_clip_content = false mouse_filter = 0 @@ -279,8 +277,8 @@ anchor_right = 0.0 anchor_bottom = 0.0 margin_left = 8.0 margin_top = 8.0 -margin_right = 396.0 -margin_bottom = 239.0 +margin_right = 459.0 +margin_bottom = 236.0 rect_pivot_offset = Vector2( 0, 0 ) rect_clip_content = true mouse_filter = 0 diff --git a/project/src/GameKit.gd b/project/src/GameKit.gd index f1b7fe8..27a1e1c 100644 --- a/project/src/GameKit.gd +++ b/project/src/GameKit.gd @@ -10,4 +10,6 @@ func is_game_paused(is_paused): func switch_scenes(is_mode): if is_mode == "title": - get_tree().change_scene("res://scn/TitleScn.tscn") \ No newline at end of file + get_tree().change_scene("res://scn/TitleScn.tscn") + elif is_mode == "game": + get_tree().change_scene("res://scn/GameScn.tscn") \ No newline at end of file diff --git a/project/src/GameScn.gd b/project/src/GameScn.gd new file mode 100644 index 0000000..d5b5dc2 --- /dev/null +++ b/project/src/GameScn.gd @@ -0,0 +1,6 @@ +extends "res://src/GameKit.gd" + +func _process(delta): + if Input.is_action_pressed("ui_pause"): + is_game_paused(true) + $WinDialogs/PauseWin.show() \ No newline at end of file diff --git a/project/src/TitleScn.gd b/project/src/TitleScn.gd new file mode 100644 index 0000000..549c0c5 --- /dev/null +++ b/project/src/TitleScn.gd @@ -0,0 +1,10 @@ +extends "res://src/GameKit.gd" + +func _on_PlayBtn_pressed(): + switch_scenes("game") + +func _on_LicenseBtn_pressed(): + $WinDialogs/LicenseWin.show() + +func _on_CreditsBtn_pressed(): + $WinDialogs/CreditsWin.show()