mirror of
https://github.com/creyD/ludum_dare_46.git
synced 2026-06-12 05:22:23 +02:00
Added basic title screen functionality
This commit is contained in:
@@ -2,15 +2,15 @@
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/tileset_room.png-.stex"
|
||||
path="res://.import/tileset_room.png-674987c7ba950a0a830d1caa96e0c19a.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="tileset_room.png"
|
||||
dest_files=[ "res://.import/tileset_room.png-.stex" ]
|
||||
source_file="res://Maps/Tilesets/Room/tileset_room.png"
|
||||
dest_files=[ "res://.import/tileset_room.png-674987c7ba950a0a830d1caa96e0c19a.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
@@ -31,4 +31,4 @@ process/invert_color=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
||||
svg/scale=1.0
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
extends AnimatedSprite
|
||||
|
||||
signal startup_finished
|
||||
var finished_once := false
|
||||
|
||||
# Declare member variables here. Examples:
|
||||
# var a = 2
|
||||
@@ -14,3 +16,10 @@ func _ready():
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
#func _process(delta):
|
||||
# pass
|
||||
|
||||
|
||||
func _on_Startup_animation_finished():
|
||||
if not finished_once:
|
||||
emit_signal("startup_finished")
|
||||
finished_once = true
|
||||
frame = 80
|
||||
|
||||
@@ -134,3 +134,4 @@ animations = [ {
|
||||
frames = SubResource( 1 )
|
||||
centered = false
|
||||
script = ExtResource( 121 )
|
||||
[connection signal="animation_finished" from="." to="." method="_on_Startup_animation_finished"]
|
||||
|
||||
11
src/Menus/TitleScreen/TitleScreen.gd
Normal file
11
src/Menus/TitleScreen/TitleScreen.gd
Normal file
@@ -0,0 +1,11 @@
|
||||
extends Control
|
||||
class_name TitleScreen
|
||||
|
||||
onready var new_game_button = $"VBoxContainer/NewGameButton"
|
||||
|
||||
func _ready():
|
||||
new_game_button.grab_focus()
|
||||
|
||||
|
||||
func _on_Startup_startup_finished():
|
||||
pass # Replace with function body.
|
||||
@@ -1,6 +1,8 @@
|
||||
[gd_scene load_steps=2 format=2]
|
||||
[gd_scene load_steps=4 format=2]
|
||||
|
||||
[ext_resource path="res://Fonts/Harmonic/Harmonic24.tres" type="DynamicFont" id=1]
|
||||
[ext_resource path="res://Menus/TitleScreen/TitleScreenButton.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://Menus/Startup/Startup.tscn" type="PackedScene" id=2]
|
||||
[ext_resource path="res://Menus/TitleScreen/TitleScreen.gd" type="Script" id=3]
|
||||
|
||||
[node name="TitleScreen" type="Control"]
|
||||
anchor_left = -0.00168862
|
||||
@@ -9,23 +11,39 @@ anchor_right = 0.998311
|
||||
anchor_bottom = 0.996998
|
||||
margin_left = 0.875977
|
||||
margin_right = 0.875977
|
||||
script = ExtResource( 3 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Startup" parent="." instance=ExtResource( 2 )]
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||
margin_right = 40.0
|
||||
margin_bottom = 40.0
|
||||
anchor_left = 0.623951
|
||||
anchor_top = 0.225224
|
||||
anchor_right = 0.970827
|
||||
anchor_bottom = 0.469669
|
||||
margin_left = 1.52588e-05
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
"_edit_group_": true,
|
||||
"_edit_use_anchors_": true
|
||||
}
|
||||
|
||||
[node name="Label" type="Label" parent="VBoxContainer"]
|
||||
margin_right = 111.0
|
||||
margin_bottom = 24.0
|
||||
custom_fonts/font = ExtResource( 1 )
|
||||
text = "Start Game"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false,
|
||||
"_editor_description_": ""
|
||||
}
|
||||
[node name="NewGameButton" parent="VBoxContainer" instance=ExtResource( 1 )]
|
||||
scene_to_load = "res://World.tscn"
|
||||
|
||||
[node name="Label" parent="VBoxContainer/NewGameButton" index="0"]
|
||||
text = "New Game"
|
||||
|
||||
[node name="QuitButton" parent="VBoxContainer" instance=ExtResource( 1 )]
|
||||
margin_top = 24.0
|
||||
margin_bottom = 44.0
|
||||
quit = true
|
||||
|
||||
[node name="Label" parent="VBoxContainer/QuitButton" index="0"]
|
||||
text = "Quit"
|
||||
[connection signal="startup_finished" from="Startup" to="." method="_on_Startup_startup_finished"]
|
||||
|
||||
[editable path="VBoxContainer/NewGameButton"]
|
||||
|
||||
[editable path="VBoxContainer/QuitButton"]
|
||||
|
||||
12
src/Menus/TitleScreen/TitleScreenButton.gd
Normal file
12
src/Menus/TitleScreen/TitleScreenButton.gd
Normal file
@@ -0,0 +1,12 @@
|
||||
extends Button
|
||||
class_name TitleSceenButton
|
||||
|
||||
export(String, FILE, "*.tscn,*.scn") var scene_to_load = ""
|
||||
export(bool) var quit = false
|
||||
|
||||
func _pressed():
|
||||
if quit:
|
||||
get_tree().quit()
|
||||
return
|
||||
|
||||
get_tree().change_scene(scene_to_load)
|
||||
21
src/Menus/TitleScreen/TitleScreenButton.tscn
Normal file
21
src/Menus/TitleScreen/TitleScreenButton.tscn
Normal file
@@ -0,0 +1,21 @@
|
||||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://Fonts/Harmonic/Harmonic24.tres" type="DynamicFont" id=1]
|
||||
[ext_resource path="res://Menus/TitleScreen/TitleScreenButton.gd" type="Script" id=2]
|
||||
|
||||
[node name="TitleScreenButton" type="Button"]
|
||||
margin_right = 110.0
|
||||
margin_bottom = 20.0
|
||||
flat = true
|
||||
script = ExtResource( 2 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Label" type="Label" parent="."]
|
||||
custom_fonts/font = ExtResource( 1 )
|
||||
text = "Label"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false,
|
||||
"_editor_description_": ""
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
[gd_scene load_steps=3 format=2]
|
||||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://Player/Player.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://Menus/Startup/Startup.tscn" type="PackedScene" id=2]
|
||||
|
||||
[node name="World" type="Node2D"]
|
||||
|
||||
@@ -12,5 +11,3 @@ position = Vector2( 164.844, 101.687 )
|
||||
|
||||
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="StaticBody2D"]
|
||||
polygon = PoolVector2Array( 192.287, 146.593, 265.375, 115.213, 228.831, 67.1505, 257.43, 37.3594, 218.9, 7.9655, 298.343, 3.59614, 310.26, 179.959, 11.9516, 168.837, 42.9343, 30.6067, 69.1505, 118.788, 86.628, 87.4084, 96.5583, 127.527 )
|
||||
|
||||
[node name="Startup" parent="." instance=ExtResource( 2 )]
|
||||
|
||||
@@ -13,9 +13,21 @@ _global_script_classes=[ {
|
||||
"class": "Player",
|
||||
"language": "GDScript",
|
||||
"path": "res://Player/Player.gd"
|
||||
}, {
|
||||
"base": "Button",
|
||||
"class": "TitleSceenButton",
|
||||
"language": "GDScript",
|
||||
"path": "res://Menus/TitleScreen/TitleScreenButton.gd"
|
||||
}, {
|
||||
"base": "Control",
|
||||
"class": "TitleScreen",
|
||||
"language": "GDScript",
|
||||
"path": "res://Menus/TitleScreen/TitleScreen.gd"
|
||||
} ]
|
||||
_global_script_class_icons={
|
||||
"Player": ""
|
||||
"Player": "",
|
||||
"TitleSceenButton": "",
|
||||
"TitleScreen": ""
|
||||
}
|
||||
|
||||
[application]
|
||||
|
||||
Reference in New Issue
Block a user