2048-Shooter/Main Scenes/MainMenu.tscn

93 lines
2.2 KiB
Plaintext
Raw Normal View History

2022-11-29 22:53:29 +01:00
[gd_scene load_steps=6 format=2]
2022-11-27 20:47:03 +01:00
[ext_resource path="res://Font/super-legend-boy-font/SuperLegendBoy-4w8Y.ttf" type="DynamicFontData" id=1]
[ext_resource path="res://retrowave.png" type="Texture" id=2]
[sub_resource type="GDScript" id=2]
script/source = "extends Node2D
2022-11-29 22:53:29 +01:00
var score_file = \"user://highscore_2048Shooter.save\"
2022-11-27 20:47:03 +01:00
# Declare member variables here. Examples:
# var a = 2
# var b = \"text\"
# Called when the node enters the scene tree for the first time.
func _ready():
2022-11-29 22:53:29 +01:00
load_score()
2022-11-27 20:47:03 +01:00
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
# pass
func _on_Start_pressed():
get_tree().change_scene(\"res://Main Scenes/Game.tscn\")
pass # Replace with function body.
2022-11-29 22:53:29 +01:00
func load_score():
var f = File.new()
if f.file_exists(score_file):
$Control/Score.visible = true
f.open(score_file, File.READ)
$Control/Score.text = \"Score: \" + f.get_var() as String
f.close()
else:
$Control/Score.text = '0'
2022-11-27 20:47:03 +01:00
"
[sub_resource type="DynamicFont" id=1]
font_data = ExtResource( 1 )
2022-11-29 22:53:29 +01:00
[sub_resource type="DynamicFont" id=3]
size = 40
font_data = ExtResource( 1 )
[node name="MainMenu" type="Node2D"]
2022-11-27 20:47:03 +01:00
script = SubResource( 2 )
[node name="Background" type="Sprite" parent="."]
position = Vector2( 288, 592 )
scale = Vector2( 0.463768, 0.5 )
texture = ExtResource( 2 )
[node name="Control" type="Control" parent="."]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = 288.0
margin_top = 504.0
margin_right = 328.0
margin_bottom = 544.0
[node name="VBoxContainer" type="VBoxContainer" parent="Control"]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -180.0
2022-11-29 22:53:29 +01:00
margin_top = 244.0
2022-11-27 20:47:03 +01:00
margin_right = 140.0
2022-11-29 22:53:29 +01:00
margin_bottom = 396.0
2022-11-27 20:47:03 +01:00
[node name="Button" type="Button" parent="Control/VBoxContainer"]
margin_right = 320.0
margin_bottom = 70.0
rect_min_size = Vector2( 0, 70 )
custom_fonts/font = SubResource( 1 )
text = "Start"
2022-11-29 22:53:29 +01:00
[node name="Score" type="Label" parent="Control"]
margin_left = -264.0
margin_top = -424.0
margin_right = -69.0
margin_bottom = -368.0
custom_fonts/font = SubResource( 3 )
text = "Score: "
2022-11-27 20:47:03 +01:00
[connection signal="pressed" from="Control/VBoxContainer/Button" to="." method="_on_Start_pressed"]