From 2c1f5a0f93215429708faebcb532559db4b11c82 Mon Sep 17 00:00:00 2001 From: VAILLANT Jeremy Date: Sat, 8 May 2021 12:49:27 +0200 Subject: [PATCH 1/6] Add basic scene interface --- default_env.tres | 2 ++ project.godot | 2 +- scenes/main.tscn | 42 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 scenes/main.tscn diff --git a/default_env.tres b/default_env.tres index 98f26a7..20207a4 100644 --- a/default_env.tres +++ b/default_env.tres @@ -1,5 +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 ) diff --git a/project.godot b/project.godot index a0952ac..14dcb45 100644 --- a/project.godot +++ b/project.godot @@ -11,6 +11,7 @@ config_version=4 [application] config/name="Athena-Hidden-Object" +run/main_scene="res://scenes/main.tscn" config/icon="res://icon.png" [physics] @@ -19,5 +20,4 @@ common/enable_pause_aware_picking=true [rendering] -quality/driver/driver_name="GLES3" environment/default_environment="res://default_env.tres" diff --git a/scenes/main.tscn b/scenes/main.tscn new file mode 100644 index 0000000..793627f --- /dev/null +++ b/scenes/main.tscn @@ -0,0 +1,42 @@ +[gd_scene format=2] + +[node name="Main" type="Node2D"] + +[node name="Grid" type="GridContainer" parent="."] +margin_left = -1.33484 +margin_right = 1022.67 +margin_bottom = 600.0 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Title" type="Label" parent="Grid"] +margin_right = 151.0 +margin_bottom = 14.0 +text = "Athena - Hidden Object" +align = 1 +valign = 1 + +[node name="New" type="LinkButton" parent="Grid"] +margin_top = 18.0 +margin_right = 151.0 +margin_bottom = 32.0 +text = "Nouveau" + +[node name="Continue" type="LinkButton" parent="Grid"] +margin_top = 36.0 +margin_right = 151.0 +margin_bottom = 50.0 +text = "Reprendre" + +[node name="About" type="LinkButton" parent="Grid"] +margin_top = 54.0 +margin_right = 151.0 +margin_bottom = 68.0 +text = "Credit" + +[node name="Quit" type="LinkButton" parent="Grid"] +margin_top = 72.0 +margin_right = 151.0 +margin_bottom = 86.0 +text = "Quitter" From 28142b2545f244e2670d2c29d3c070d9ad8b7e9a Mon Sep 17 00:00:00 2001 From: VAILLANT Jeremy Date: Sat, 8 May 2021 12:51:30 +0200 Subject: [PATCH 2/6] Add screne interfaces --- scenes/UI/About.tscn | 8 ++++++++ scenes/UI/ChooseScene.tscn | 8 ++++++++ 2 files changed, 16 insertions(+) create mode 100644 scenes/UI/About.tscn create mode 100644 scenes/UI/ChooseScene.tscn diff --git a/scenes/UI/About.tscn b/scenes/UI/About.tscn new file mode 100644 index 0000000..c56b556 --- /dev/null +++ b/scenes/UI/About.tscn @@ -0,0 +1,8 @@ +[gd_scene format=2] + +[node name="About" type="Control"] +anchor_right = 1.0 +anchor_bottom = 1.0 +__meta__ = { +"_edit_use_anchors_": false +} diff --git a/scenes/UI/ChooseScene.tscn b/scenes/UI/ChooseScene.tscn new file mode 100644 index 0000000..81d2651 --- /dev/null +++ b/scenes/UI/ChooseScene.tscn @@ -0,0 +1,8 @@ +[gd_scene format=2] + +[node name="ChooseScene" type="Control"] +anchor_right = 1.0 +anchor_bottom = 1.0 +__meta__ = { +"_edit_use_anchors_": false +} From 3de364623b4d1702652bd5d48e308018eeb82aba Mon Sep 17 00:00:00 2001 From: VAILLANT Jeremy Date: Sat, 8 May 2021 12:55:27 +0200 Subject: [PATCH 3/6] Add scene for warcraft scene --- scenes/levels/WarCraft.tscn | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 scenes/levels/WarCraft.tscn diff --git a/scenes/levels/WarCraft.tscn b/scenes/levels/WarCraft.tscn new file mode 100644 index 0000000..9926b63 --- /dev/null +++ b/scenes/levels/WarCraft.tscn @@ -0,0 +1,3 @@ +[gd_scene format=2] + +[node name="Warcraft" type="Spatial"] From e164cef2c2dc1da46e8ee05dd89c17ad6ae696cd Mon Sep 17 00:00:00 2001 From: VAILLANT Jeremy Date: Sat, 8 May 2021 13:16:13 +0200 Subject: [PATCH 4/6] Quit the game --- scenes/main.gd | 5 +++++ scenes/main.tscn | 15 +++++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 scenes/main.gd diff --git a/scenes/main.gd b/scenes/main.gd new file mode 100644 index 0000000..8c33aee --- /dev/null +++ b/scenes/main.gd @@ -0,0 +1,5 @@ +extends Node + +# Quit the game +func _on_Quit_pressed(): + get_tree().quit(0) diff --git a/scenes/main.tscn b/scenes/main.tscn index 793627f..9dbff2e 100644 --- a/scenes/main.tscn +++ b/scenes/main.tscn @@ -1,6 +1,14 @@ -[gd_scene format=2] +[gd_scene load_steps=3 format=2] -[node name="Main" type="Node2D"] +[ext_resource path="res://scenes/main.gd" type="Script" id=1] + +[sub_resource type="GDScript" id=1] +script/source = "extends LinkButton + +# Quit the game with properly exit code" + +[node name="Main" type="Node"] +script = ExtResource( 1 ) [node name="Grid" type="GridContainer" parent="."] margin_left = -1.33484 @@ -40,3 +48,6 @@ margin_top = 72.0 margin_right = 151.0 margin_bottom = 86.0 text = "Quitter" +script = SubResource( 1 ) + +[connection signal="pressed" from="Grid/Quit" to="." method="_on_Quit_pressed"] From 4bd3daa7478bea0f168d1bbe89866fbddf091587 Mon Sep 17 00:00:00 2001 From: VAILLANT Jeremy Date: Sat, 8 May 2021 13:22:37 +0200 Subject: [PATCH 5/6] Link about scenes --- scenes/UI/About.gd | 9 +++++++++ scenes/UI/About.tscn | 37 +++++++++++++++++++++++++++++++++---- scenes/main.gd | 4 ++++ scenes/main.tscn | 4 +++- 4 files changed, 49 insertions(+), 5 deletions(-) create mode 100644 scenes/UI/About.gd diff --git a/scenes/UI/About.gd b/scenes/UI/About.gd new file mode 100644 index 0000000..7340780 --- /dev/null +++ b/scenes/UI/About.gd @@ -0,0 +1,9 @@ +extends Node + + +# Called when the node enters the scene tree for the first time. +func _ready(): + pass # Replace with function body. + +func _on_Return_pressed(): + get_tree().change_scene("res://scenes/main.tscn") diff --git a/scenes/UI/About.tscn b/scenes/UI/About.tscn index c56b556..6ced9c2 100644 --- a/scenes/UI/About.tscn +++ b/scenes/UI/About.tscn @@ -1,8 +1,37 @@ -[gd_scene format=2] +[gd_scene load_steps=2 format=2] -[node name="About" type="Control"] -anchor_right = 1.0 -anchor_bottom = 1.0 +[ext_resource path="res://scenes/UI/About.gd" type="Script" id=1] + +[node name="About" type="Node"] +script = ExtResource( 1 ) + +[node name="GRem" type="Label" parent="."] +margin_left = 150.0 +margin_top = 150.0 +margin_right = 416.0 +margin_bottom = 181.0 +text = "Lead Develop : GRem -- VAILLANT Jérémy +" __meta__ = { "_edit_use_anchors_": false } + +[node name="Stilobique" type="Label" parent="."] +margin_left = 300.0 +margin_top = 300.0 +margin_right = 583.0 +margin_bottom = 331.0 +text = "Lead Artist : Stilobique -- VAILLANT Aurelien" +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Return" type="LinkButton" parent="."] +margin_right = 40.0 +margin_bottom = 14.0 +text = "back" +__meta__ = { +"_edit_use_anchors_": false +} + +[connection signal="pressed" from="Return" to="." method="_on_Return_pressed"] diff --git a/scenes/main.gd b/scenes/main.gd index 8c33aee..87349b7 100644 --- a/scenes/main.gd +++ b/scenes/main.gd @@ -3,3 +3,7 @@ extends Node # Quit the game func _on_Quit_pressed(): get_tree().quit(0) + +# Load scene about +func _on_About_pressed(): + get_tree().change_scene("res://scenes/UI/About.tscn") diff --git a/scenes/main.tscn b/scenes/main.tscn index 9dbff2e..0b74a77 100644 --- a/scenes/main.tscn +++ b/scenes/main.tscn @@ -5,7 +5,8 @@ [sub_resource type="GDScript" id=1] script/source = "extends LinkButton -# Quit the game with properly exit code" +# Quit the game with properly exit code +" [node name="Main" type="Node"] script = ExtResource( 1 ) @@ -50,4 +51,5 @@ margin_bottom = 86.0 text = "Quitter" script = SubResource( 1 ) +[connection signal="pressed" from="Grid/About" to="." method="_on_About_pressed"] [connection signal="pressed" from="Grid/Quit" to="." method="_on_Quit_pressed"] From b683302b2b91cd627e2b7742bc71b11b95b7aa70 Mon Sep 17 00:00:00 2001 From: VAILLANT Jeremy Date: Sat, 8 May 2021 13:44:51 +0200 Subject: [PATCH 6/6] Complete menu navigation --- scenes/UI/ChooseScene.gd | 7 +++++++ scenes/UI/ChooseScene.tscn | 26 +++++++++++++++++++++++++- scenes/main.gd | 4 ++++ scenes/main.tscn | 2 ++ 4 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 scenes/UI/ChooseScene.gd diff --git a/scenes/UI/ChooseScene.gd b/scenes/UI/ChooseScene.gd new file mode 100644 index 0000000..aa5922a --- /dev/null +++ b/scenes/UI/ChooseScene.gd @@ -0,0 +1,7 @@ +extends Control + +func _on_Return_pressed(): + get_tree().change_scene("res://scenes/main.tscn") + +func _on_WarCraft_pressed(): + get_tree().change_scene("res://scenes/levels/WarCraft.tscn") diff --git a/scenes/UI/ChooseScene.tscn b/scenes/UI/ChooseScene.tscn index 81d2651..c833225 100644 --- a/scenes/UI/ChooseScene.tscn +++ b/scenes/UI/ChooseScene.tscn @@ -1,8 +1,32 @@ -[gd_scene format=2] +[gd_scene load_steps=2 format=2] + +[ext_resource path="res://scenes/UI/ChooseScene.gd" type="Script" id=1] [node name="ChooseScene" type="Control"] anchor_right = 1.0 anchor_bottom = 1.0 +script = ExtResource( 1 ) __meta__ = { "_edit_use_anchors_": false } + +[node name="GridContainer" type="GridContainer" parent="."] +margin_right = 1024.0 +margin_bottom = 600.0 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Return" type="LinkButton" parent="GridContainer"] +margin_right = 54.0 +margin_bottom = 14.0 +text = "back" + +[node name="WarCraft" type="LinkButton" parent="GridContainer"] +margin_top = 18.0 +margin_right = 54.0 +margin_bottom = 32.0 +text = "WarCraft" + +[connection signal="pressed" from="GridContainer/Return" to="." method="_on_Return_pressed"] +[connection signal="pressed" from="GridContainer/WarCraft" to="." method="_on_WarCraft_pressed"] diff --git a/scenes/main.gd b/scenes/main.gd index 87349b7..1d9700f 100644 --- a/scenes/main.gd +++ b/scenes/main.gd @@ -7,3 +7,7 @@ func _on_Quit_pressed(): # Load scene about func _on_About_pressed(): get_tree().change_scene("res://scenes/UI/About.tscn") + +# Load scene for select game +func _on_New_pressed(): + get_tree().change_scene("res://scenes/UI/ChooseScene.tscn") diff --git a/scenes/main.tscn b/scenes/main.tscn index 0b74a77..5d5cc56 100644 --- a/scenes/main.tscn +++ b/scenes/main.tscn @@ -36,6 +36,7 @@ text = "Nouveau" margin_top = 36.0 margin_right = 151.0 margin_bottom = 50.0 +disabled = true text = "Reprendre" [node name="About" type="LinkButton" parent="Grid"] @@ -51,5 +52,6 @@ margin_bottom = 86.0 text = "Quitter" script = SubResource( 1 ) +[connection signal="pressed" from="Grid/New" to="." method="_on_New_pressed"] [connection signal="pressed" from="Grid/About" to="." method="_on_About_pressed"] [connection signal="pressed" from="Grid/Quit" to="." method="_on_Quit_pressed"]