From 3cdb38436cd6a0d6bec0544fb509305ae00accef Mon Sep 17 00:00:00 2001 From: Cookie-CHR Date: Mon, 4 Apr 2022 15:55:45 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=8F=EF=B8=8F=20Main=20menu=20(first=20ver?= =?UTF-8?q?sion)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- project.godot | 2 +- src/levels/MainMenu.gd | 17 ++++++----------- src/levels/MainMenu.tscn | 23 ++++++++++++++++++----- src/ui/PlayButton.png | 3 +++ src/ui/PlayButton.png.import | 35 +++++++++++++++++++++++++++++++++++ src/ui/Title.png | 3 +++ src/ui/Title.png.import | 35 +++++++++++++++++++++++++++++++++++ 7 files changed, 101 insertions(+), 17 deletions(-) create mode 100644 src/ui/PlayButton.png create mode 100644 src/ui/PlayButton.png.import create mode 100644 src/ui/Title.png create mode 100644 src/ui/Title.png.import diff --git a/project.godot b/project.godot index 59ad3e7..3fefadf 100644 --- a/project.godot +++ b/project.godot @@ -129,7 +129,7 @@ _global_script_class_icons={ [application] config/name="LD50" -run/main_scene="res://src/levels/Game.tscn" +run/main_scene="res://src/levels/MainMenu.tscn" [audio] diff --git a/src/levels/MainMenu.gd b/src/levels/MainMenu.gd index d144d48..7300b29 100644 --- a/src/levels/MainMenu.gd +++ b/src/levels/MainMenu.gd @@ -1,16 +1,11 @@ extends Node2D -# Declare member variables here. Examples: -# var a = 2 -# var b = "text" +func _ready(): + for child in get_children(): + if child.name == "Play": + get_node(child.name).connect("pressed", self, "change_scn") +func change_scn(): + get_tree().change_scene("res://src/levels/Game.tscn") -# 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 diff --git a/src/levels/MainMenu.tscn b/src/levels/MainMenu.tscn index 941bdcb..d0984ae 100644 --- a/src/levels/MainMenu.tscn +++ b/src/levels/MainMenu.tscn @@ -1,11 +1,24 @@ -[gd_scene load_steps=2 format=2] +[gd_scene load_steps=4 format=2] [ext_resource path="res://src/levels/MainMenu.gd" type="Script" id=1] +[ext_resource path="res://src/ui/Title.png" type="Texture" id=2] +[ext_resource path="res://src/ui/PlayButton.png" type="Texture" id=3] [node name="MainMenu" type="Node2D"] script = ExtResource( 1 ) -[node name="Label" type="Label" parent="."] -margin_right = 40.0 -margin_bottom = 14.0 -text = "Hello world!" +[node name="Panel" type="Panel" parent="."] +margin_right = 1280.0 +margin_bottom = 720.0 + +[node name="Sprite" type="Sprite" parent="Panel"] +position = Vector2( 640.881, 360.696 ) +texture = ExtResource( 2 ) + +[node name="Play" type="Button" parent="."] +margin_left = 580.0 +margin_top = 540.0 +margin_right = 12.0 +margin_bottom = 20.0 +icon = ExtResource( 3 ) +flat = true diff --git a/src/ui/PlayButton.png b/src/ui/PlayButton.png new file mode 100644 index 0000000..74d81b8 --- /dev/null +++ b/src/ui/PlayButton.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:619dda962506a760592ec31288804014beef768e092bbc7478c0fe0be791f59a +size 7313 diff --git a/src/ui/PlayButton.png.import b/src/ui/PlayButton.png.import new file mode 100644 index 0000000..30a6acc --- /dev/null +++ b/src/ui/PlayButton.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/PlayButton.png-bbb75720f98ee0da7cc56e3bae2f00bf.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://src/ui/PlayButton.png" +dest_files=[ "res://.import/PlayButton.png-bbb75720f98ee0da7cc56e3bae2f00bf.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 +process/normal_map_invert_y=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/src/ui/Title.png b/src/ui/Title.png new file mode 100644 index 0000000..011df7b --- /dev/null +++ b/src/ui/Title.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9166dfac6cbc0cb2fc4bd877a88efd4414a0c515e7988725c8646679a8094b62 +size 220905 diff --git a/src/ui/Title.png.import b/src/ui/Title.png.import new file mode 100644 index 0000000..2d06982 --- /dev/null +++ b/src/ui/Title.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/Title.png-eddaf0247c16f2cd01805f96e728b10b.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://src/ui/Title.png" +dest_files=[ "res://.import/Title.png-eddaf0247c16f2cd01805f96e728b10b.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 +process/normal_map_invert_y=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0