Working title and game screen

- Added local translations
- Added functionality to the title and game screens
- Fixed a few overlooked things
This commit is contained in:
Anthony Wilcox 2019-01-09 21:17:39 -05:00
parent 8d3ac754f3
commit f801b82abe
12 changed files with 189 additions and 28 deletions

View file

@ -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.
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.

14
project/lang/local.csv Normal file
View file

@ -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
1 en sv
2 KENG English Engelsk
3 KSWD Swedish Svenska
4 KRUS Resume Återuppta
5 KPUS Paused Pausad
6 KPLY Play Spela
7 KCRE Credits Eftertexter
8 KABO About Handla om
9 KLIC License Licens
10 KSOO Coming Soon Kommer snart
11 KEXT Exit Utgång
12 KHELP Help Hjälp
13 KSET Settings Inställningar
14 KLANG Languages Språk

View file

@ -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

Binary file not shown.

Binary file not shown.

View file

@ -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" )

12
project/scn/GameScn.tscn Normal file
View file

@ -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 )]

View file

@ -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"]

View file

@ -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

View file

@ -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")
get_tree().change_scene("res://scn/TitleScn.tscn")
elif is_mode == "game":
get_tree().change_scene("res://scn/GameScn.tscn")

6
project/src/GameScn.gd Normal file
View file

@ -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()

10
project/src/TitleScn.gd Normal file
View file

@ -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()