Added demo project to show how we can make our start game work.

This commit is contained in:
Luke Gebbink 2021-09-26 12:55:48 -06:00
parent f4200838bc
commit 02810ce38c
12 changed files with 246 additions and 0 deletions

View File

@ -0,0 +1,3 @@
source_md5="47313fa4c47a9963fddd764e1ec6e4a8"
dest_md5="2ded9e7f9060e2b530aab678b135fc5b"

76
GodotUI/GUI.tscn Normal file
View File

@ -0,0 +1,76 @@
[gd_scene load_steps=4 format=2]
[ext_resource path="res://Player_Settings_Button.gd" type="Script" id=1]
[ext_resource path="res://HostAndJoinGame.gd" type="Script" id=2]
[ext_resource path="res://Start Game.gd" type="Script" id=3]
[node name="GUI" type="MarginContainer"]
anchor_right = 1.0
anchor_bottom = 1.0
margin_top = -0.418091
margin_bottom = -0.418091
custom_constants/margin_right = 120
custom_constants/margin_top = 80
custom_constants/margin_left = 120
custom_constants/margin_bottom = 80
__meta__ = {
"_edit_use_anchors_": false
}
[node name="HBoxContainer" type="HBoxContainer" parent="."]
margin_left = 120.0
margin_top = 80.0
margin_right = 904.0
margin_bottom = 520.0
[node name="VBoxContainer" type="VBoxContainer" parent="HBoxContainer"]
margin_right = 112.0
margin_bottom = 440.0
[node name="MenuOptions" type="VBoxContainer" parent="HBoxContainer/VBoxContainer"]
margin_right = 112.0
margin_bottom = 440.0
size_flags_vertical = 3
custom_constants/separation = 30
alignment = 1
[node name="Start Game" type="Label" parent="HBoxContainer/VBoxContainer/MenuOptions"]
margin_top = 169.0
margin_right = 112.0
margin_bottom = 183.0
mouse_filter = 1
text = "Start Game"
script = ExtResource( 3 )
[node name="HostAndJoinGame" type="Label" parent="HBoxContainer/VBoxContainer/MenuOptions"]
margin_top = 213.0
margin_right = 112.0
margin_bottom = 227.0
mouse_filter = 1
text = "Host / Join Game"
script = ExtResource( 2 )
[node name="Player Settings" type="Label" parent="HBoxContainer/VBoxContainer/MenuOptions"]
margin_top = 257.0
margin_right = 112.0
margin_bottom = 271.0
mouse_filter = 1
text = "Player Settings"
script = ExtResource( 1 )
[node name="CenterContainer" type="CenterContainer" parent="HBoxContainer"]
margin_left = 116.0
margin_right = 784.0
margin_bottom = 440.0
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="Label" type="Label" parent="HBoxContainer/CenterContainer"]
margin_left = 300.0
margin_top = 213.0
margin_right = 367.0
margin_bottom = 227.0
text = "Test Menu"
[connection signal="gui_input" from="HBoxContainer/VBoxContainer/MenuOptions/Start Game" to="HBoxContainer/VBoxContainer/MenuOptions/Start Game" method="_on_Start_Game_gui_input"]
[connection signal="gui_input" from="HBoxContainer/VBoxContainer/MenuOptions/HostAndJoinGame" to="HBoxContainer/VBoxContainer/MenuOptions/HostAndJoinGame" method="_on_HostAndJoinGame_gui_input"]
[connection signal="gui_input" from="HBoxContainer/VBoxContainer/MenuOptions/Player Settings" to="HBoxContainer/VBoxContainer/MenuOptions/Player Settings" method="_on_Player_Settings_gui_input"]

View File

@ -0,0 +1,21 @@
extends Label
# 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
func _on_HostAndJoinGame_gui_input(event):
if (event is InputEventMouseButton && event.pressed && event.button_index == 1):
print("Clicked Host and Join Game")

View File

@ -0,0 +1,24 @@
extends Label
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
func _unhandled_input(event):
if event is InputEventKey:
if event.pressed and event.scancode == KEY_ESCAPE:
get_tree().quit()
# 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
func _on_Player_Settings_gui_input(event):
if (event is InputEventMouseButton && event.pressed && event.button_index == 1):
print("Clicked Player Settings")

17
GodotUI/Start Game.gd Normal file
View File

@ -0,0 +1,17 @@
extends Label
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
var option = 0
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
func _on_Start_Game_gui_input(event):
if (event is InputEventMouseButton && event.pressed && event.button_index == 1):
print("Clicked Start Game")
get_tree().change_scene("res://TestNode2D.tscn")
# Start Game button opens a new node for that purpose

23
GodotUI/TestNode2D.gd Normal file
View File

@ -0,0 +1,23 @@
extends Node2D
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
var isPaused = false
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
# Make this function return a boolean.
func _isPaused():
if isPaused == true:
print("Unpaused")
if isPaused == false:
print("Paused")
return isPaused
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
# pass

14
GodotUI/TestNode2D.tscn Normal file
View File

@ -0,0 +1,14 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://TestNode2D.gd" type="Script" id=1]
[node name="Node2D" type="Node2D"]
script = ExtResource( 1 )
[node name="Label" type="Label" parent="."]
margin_right = 40.0
margin_bottom = 14.0
text = "Game Started Node"
__meta__ = {
"_edit_use_anchors_": false
}

7
GodotUI/default_env.tres Normal file
View File

@ -0,0 +1,7 @@
[gd_resource type="Environment" load_steps=2 format=2]
[sub_resource type="ProceduralSky" id=1]
[resource]
background_mode = 2
background_sky = SubResource( 1 )

BIN
GodotUI/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

34
GodotUI/icon.png.import Normal file
View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://icon.png"
dest_files=[ "res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.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

27
GodotUI/project.godot Normal file
View File

@ -0,0 +1,27 @@
; Engine configuration file.
; It's best edited using the editor UI and not directly,
; since the parameters that go here are not all obvious.
;
; Format:
; [section] ; section goes between []
; param=value ; assign values to parameters
config_version=4
_global_script_classes=[ ]
_global_script_class_icons={
}
[application]
config/name="Godot Ui"
run/main_scene="res://GUI.tscn"
config/icon="res://icon.png"
[rendering]
quality/driver/driver_name="GLES2"
vram_compression/import_etc=true
vram_compression/import_etc2=false
environment/default_environment="res://default_env.tres"