diff --git a/assets/levels/warcraft.jpg b/assets/levels/warcraft.jpg index dac7903..0dee25b 100644 Binary files a/assets/levels/warcraft.jpg and b/assets/levels/warcraft.jpg differ diff --git a/scenes/UI/About.gd b/scenes/UI/About.gd deleted file mode 100644 index 7340780..0000000 --- a/scenes/UI/About.gd +++ /dev/null @@ -1,9 +0,0 @@ -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 db38cf8..3eab727 100644 --- a/scenes/UI/About.tscn +++ b/scenes/UI/About.tscn @@ -1,9 +1,19 @@ [gd_scene load_steps=2 format=2] -[ext_resource path="res://scenes/UI/About.gd" type="Script" id=1] +[sub_resource type="GDScript" id=1] +script/source = "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\") +" [node name="About" type="Node"] -script = ExtResource( 1 ) +script = SubResource( 1 ) [node name="GRem" type="Label" parent="."] margin_left = 350.0 @@ -25,13 +35,3 @@ 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/UI/ChooseScene.gd b/scenes/UI/ChooseScene.gd index aa5922a..76ab863 100644 --- a/scenes/UI/ChooseScene.gd +++ b/scenes/UI/ChooseScene.gd @@ -1,7 +1,4 @@ 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 c833225..9df5920 100644 --- a/scenes/UI/ChooseScene.tscn +++ b/scenes/UI/ChooseScene.tscn @@ -1,32 +1,30 @@ -[gd_scene load_steps=2 format=2] +[gd_scene load_steps=3 format=2] [ext_resource path="res://scenes/UI/ChooseScene.gd" type="Script" id=1] +[ext_resource path="res://assets/levels/warcraft.jpg" type="Texture" id=2] [node name="ChooseScene" type="Control"] anchor_right = 1.0 anchor_bottom = 1.0 +margin_left = 200.0 script = ExtResource( 1 ) __meta__ = { "_edit_use_anchors_": false } [node name="GridContainer" type="GridContainer" parent="."] -margin_right = 1024.0 -margin_bottom = 600.0 +margin_left = 25.0 +margin_top = 26.2599 +margin_right = 824.0 +margin_bottom = 601.26 __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="TextureButton" parent="GridContainer"] +margin_right = 150.0 +margin_bottom = 150.0 +mouse_default_cursor_shape = 2 +texture_normal = ExtResource( 2 ) -[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 1d9700f..62e3dac 100644 --- a/scenes/main.gd +++ b/scenes/main.gd @@ -1,13 +1,28 @@ extends Node +export (PackedScene) var about = load("res://scenes/UI/About.tscn") +export (PackedScene) var scenes = load("res://scenes/UI/ChooseScene.tscn") + +var scene + # 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") + _prepare_change_scene() + scene = about.instance() + add_child(scene) # Load scene for select game func _on_New_pressed(): - get_tree().change_scene("res://scenes/UI/ChooseScene.tscn") + _prepare_change_scene() + scene = scenes.instance() + add_child(scene) + +## PRIVATE +func _prepare_change_scene(): + if (scene != null): + remove_child(scene) + scene.call_deferred("free") diff --git a/scenes/main.tscn b/scenes/main.tscn index 8a6dc45..628b30e 100644 --- a/scenes/main.tscn +++ b/scenes/main.tscn @@ -102,6 +102,9 @@ margin_right = 151.0 margin_bottom = 98.0 text = "Quitter" script = SubResource( 1 ) +__meta__ = { +"_edit_use_anchors_": false +} [connection signal="pressed" from="Grid/Menu/Action/New" to="." method="_on_New_pressed"] [connection signal="pressed" from="Grid/Menu/Action/About" to="." method="_on_About_pressed"]