Added a main menu.

- Controls section still not implemented. Dont thing we need it at all
 - Need to add last best score + player name Maybe...
This commit is contained in:
Sagi Dayan 2020-09-27 16:42:40 -04:00
parent 08cf3e1462
commit 1c640fcd39
10 changed files with 270 additions and 39 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 855 B

View file

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

View file

@ -1,3 +0,0 @@
[gd_resource type="BitmapFont" format=2]
[resource]

View file

@ -0,0 +1,9 @@
[gd_resource type="DynamicFont" load_steps=2 format=2]
[ext_resource path="res://assets/Theme/slkscr.ttf" type="DynamicFontData" id=1]
[resource]
size = 20
outline_size = 2
outline_color = Color( 0, 0, 0, 1 )
font_data = ExtResource( 1 )

View file

@ -71,7 +71,6 @@ enabled=PoolStringArray( )
[gui]
theme/custom="res://assets/Theme/Theme.tres"
theme/custom_font="res://assets/Theme/fonts.png.import"
[input]

9
src/HUD/PopupMessage.gd Normal file
View file

@ -0,0 +1,9 @@
extends Node2D
export var text := "This is a sample text"
func _ready() -> void:
$CanvasLayer/Control/TextureRect/RichTextLabel.text = text
func dismiss():
queue_free()

43
src/HUD/PopupMessage.tscn Normal file
View file

@ -0,0 +1,43 @@
[gd_scene load_steps=4 format=2]
[ext_resource path="res://assets/HUD/hud_stats_bg.png" type="Texture" id=1]
[ext_resource path="res://src/HUD/PopupMessage.gd" type="Script" id=2]
[ext_resource path="res://assets/Theme/Theme.tres" type="Theme" id=3]
[node name="PopupMessage" type="Node2D"]
script = ExtResource( 2 )
[node name="CanvasLayer" type="CanvasLayer" parent="."]
[node name="Control" type="Control" parent="CanvasLayer"]
anchor_right = 1.0
anchor_bottom = 1.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="TextureRect" type="TextureRect" parent="CanvasLayer/Control"]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -139.5
margin_top = -71.0
margin_right = 139.5
margin_bottom = 71.0
texture = ExtResource( 1 )
expand = true
[node name="RichTextLabel" type="RichTextLabel" parent="CanvasLayer/Control/TextureRect"]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -20.0
margin_top = -20.0
margin_right = 20.0
margin_bottom = 20.0
theme = ExtResource( 3 )
__meta__ = {
"_edit_use_anchors_": false
}

View file

@ -4,7 +4,7 @@
[ext_resource path="res://src/Intro/Intro.gd" type="Script" id=2]
[ext_resource path="res://assets/SplashScreen/SAGI.png" type="Texture" id=3]
[ext_resource path="res://sound/SAGI.ogg" type="AudioStream" id=4]
[ext_resource path="res://src/Levels/LevelTemplate/LevelTemplate.tscn" type="PackedScene" id=5]
[ext_resource path="res://src/Menu/MainMenu.tscn" type="PackedScene" id=5]
[ext_resource path="res://assets/Tiles/background_0.png" type="Texture" id=6]
[ext_resource path="res://assets/SplashScreen/Title.png" type="Texture" id=7]
[ext_resource path="res://assets/Items/torch_ligt_texture.png" type="Texture" id=8]

20
src/Menu/MainMenu.gd Normal file
View file

@ -0,0 +1,20 @@
extends Node2D
func _ready() -> void:
$CanvasLayer/Control/VBoxContainer/NewGameBtn.grab_focus()
func _on_ExitGameBtn_pressed() -> void:
get_tree().quit(0)
pass # Replace with function body.
func _on_ControlsBtn_pressed() -> void:
print("Not working yet")
pass # Replace with function body.
func _on_NewGameBtn_pressed() -> void:
var next_scene = load("res://src/Levels/LevelTemplate/LevelTemplate.tscn")
get_tree().change_scene_to(next_scene)
queue_free()

188
src/Menu/MainMenu.tscn Normal file
View file

@ -0,0 +1,188 @@
[gd_scene load_steps=9 format=2]
[ext_resource path="res://assets/Tiles/background_0.png" type="Texture" id=1]
[ext_resource path="res://assets/Tiles/background_2.png" type="Texture" id=2]
[ext_resource path="res://assets/Items/torch_ligt_texture.png" type="Texture" id=3]
[ext_resource path="res://assets/Tiles/background_1.png" type="Texture" id=4]
[ext_resource path="res://assets/SplashScreen/Title.png" type="Texture" id=5]
[ext_resource path="res://src/Menu/MainMenu.gd" type="Script" id=6]
[ext_resource path="res://assets/Theme/menu_font.tres" type="DynamicFont" id=7]
[sub_resource type="Animation" id=1]
resource_name = "main"
length = 6.0
loop = true
step = 1.0
tracks/0/type = "value"
tracks/0/path = NodePath("Sprite/Light2D:position")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 3, 6 ),
"transitions": PoolRealArray( 1, 0.277392, 0.435275 ),
"update": 0,
"values": [ Vector2( 73, 131 ), Vector2( 63.25, 154.25 ), Vector2( 73, 131 ) ]
}
tracks/1/type = "value"
tracks/1/path = NodePath("Sprite2/Light2D2:position")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/keys = {
"times": PoolRealArray( 0, 3, 6 ),
"transitions": PoolRealArray( 1, 0.277392, 0.554785 ),
"update": 0,
"values": [ Vector2( 105, 154.5 ), Vector2( 95.25, 177.75 ), Vector2( 105, 154.5 ) ]
}
tracks/2/type = "value"
tracks/2/path = NodePath("Sprite3:position")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/keys = {
"times": PoolRealArray( 0, 3, 6 ),
"transitions": PoolRealArray( 1, 1, 1 ),
"update": 0,
"values": [ Vector2( 0, 0 ), Vector2( 0, -13.5 ), Vector2( 0, 0 ) ]
}
tracks/3/type = "value"
tracks/3/path = NodePath("Sprite2:position")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/keys = {
"times": PoolRealArray( 0, 3, 6 ),
"transitions": PoolRealArray( 1, 1, 1 ),
"update": 0,
"values": [ Vector2( 0, 0 ), Vector2( 0, -8 ), Vector2( 0, 0 ) ]
}
tracks/4/type = "value"
tracks/4/path = NodePath("Sprite2/Light2D2:color")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/keys = {
"times": PoolRealArray( 0, 3, 6 ),
"transitions": PoolRealArray( 1, 1, 1 ),
"update": 0,
"values": [ Color( 0.65098, 0.964706, 0.588235, 1 ), Color( 0.984314, 0.811765, 0.0196078, 1 ), Color( 0.65098, 0.964706, 0.588235, 1 ) ]
}
tracks/5/type = "value"
tracks/5/path = NodePath("Sprite/Light2D:color")
tracks/5/interp = 1
tracks/5/loop_wrap = true
tracks/5/imported = false
tracks/5/enabled = true
tracks/5/keys = {
"times": PoolRealArray( 0, 2, 4, 6 ),
"transitions": PoolRealArray( 1, 1, 1, 1 ),
"update": 0,
"values": [ Color( 1, 1, 1, 1 ), Color( 0.952941, 0.341176, 0.00784314, 1 ), Color( 0.952941, 0.0313726, 0.0117647, 1 ), Color( 1, 1, 1, 1 ) ]
}
[node name="MainMenu" type="Node2D"]
script = ExtResource( 6 )
[node name="Node2D" type="Node2D" parent="."]
position = Vector2( -51, -39 )
scale = Vector2( 2, 2 )
[node name="Sprite" type="Sprite" parent="Node2D"]
texture = ExtResource( 1 )
centered = false
[node name="Light2D" type="Light2D" parent="Node2D/Sprite"]
position = Vector2( 72.8142, 131.443 )
scale = Vector2( 12.3889, 12.3889 )
texture = ExtResource( 3 )
color = Color( 0.976471, 0.515686, 0.505882, 1 )
[node name="Sprite2" type="Sprite" parent="Node2D"]
light_mask = -2147483646
position = Vector2( 0, -2.66667 )
texture = ExtResource( 4 )
centered = false
[node name="Light2D2" type="Light2D" parent="Node2D/Sprite2"]
position = Vector2( 104.814, 154.943 )
scale = Vector2( 12.3889, 12.3889 )
texture = ExtResource( 3 )
color = Color( 0.762092, 0.913725, 0.398693, 1 )
range_item_cull_mask = 3
shadow_enabled = true
[node name="Sprite3" type="Sprite" parent="Node2D"]
light_mask = 4
position = Vector2( 0, -4.5 )
texture = ExtResource( 2 )
centered = false
[node name="AnimationPlayer" type="AnimationPlayer" parent="Node2D"]
autoplay = "main"
anims/main = SubResource( 1 )
[node name="CanvasLayer" type="CanvasLayer" parent="."]
[node name="Control" type="NinePatchRect" parent="CanvasLayer"]
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = 15.0
margin_top = 15.0
margin_right = -15.0
margin_bottom = -15.0
[node name="VBoxContainer" type="VBoxContainer" parent="CanvasLayer/Control"]
anchor_left = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = -125.0
alignment = 2
__meta__ = {
"_edit_use_anchors_": false
}
[node name="NewGameBtn" type="Button" parent="CanvasLayer/Control/VBoxContainer"]
margin_top = 151.0
margin_right = 125.0
margin_bottom = 178.0
focus_neighbour_bottom = NodePath("../ControlsBtn")
custom_fonts/font = ExtResource( 7 )
text = "New Game"
[node name="ControlsBtn" type="Button" parent="CanvasLayer/Control/VBoxContainer"]
margin_top = 182.0
margin_right = 125.0
margin_bottom = 209.0
focus_neighbour_top = NodePath("../NewGameBtn")
focus_neighbour_bottom = NodePath("../ExitGameBtn")
custom_fonts/font = ExtResource( 7 )
text = "Controls"
[node name="ExitGameBtn" type="Button" parent="CanvasLayer/Control/VBoxContainer"]
margin_top = 213.0
margin_right = 125.0
margin_bottom = 240.0
focus_neighbour_top = NodePath("../ControlsBtn")
custom_fonts/font = ExtResource( 7 )
text = "Exit"
[node name="TextureRect" type="TextureRect" parent="CanvasLayer"]
margin_left = 38.0
margin_top = 35.0
margin_right = 237.0
margin_bottom = 147.0
texture = ExtResource( 5 )
expand = true
stretch_mode = 5
__meta__ = {
"_edit_use_anchors_": false
}
[connection signal="pressed" from="CanvasLayer/Control/VBoxContainer/NewGameBtn" to="." method="_on_NewGameBtn_pressed"]
[connection signal="pressed" from="CanvasLayer/Control/VBoxContainer/ControlsBtn" to="." method="_on_ControlsBtn_pressed"]
[connection signal="pressed" from="CanvasLayer/Control/VBoxContainer/ExitGameBtn" to="." method="_on_ExitGameBtn_pressed"]