Adding initial prototype 2
This commit is contained in:
33
proto2/ui/menu_root.gd
Normal file
33
proto2/ui/menu_root.gd
Normal file
@@ -0,0 +1,33 @@
|
||||
extends Control
|
||||
|
||||
# Declare member variables here. Examples:
|
||||
# var a = 2
|
||||
# var b = "text"
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
|
||||
func start_game():
|
||||
var sc = load("res://main.tscn")
|
||||
world.init_data()
|
||||
get_tree().change_scene_to(sc)
|
||||
func load_game():
|
||||
pass
|
||||
func display_options():
|
||||
var sc = load("res://ui/options.tscn")
|
||||
get_tree().change_scene_to(sc)
|
||||
func display_development():
|
||||
var sc = load("res://ui/development_menu.tscn")
|
||||
get_tree().change_scene_to(sc)
|
||||
func quit_game():
|
||||
get_tree().quit()
|
||||
func _ready():
|
||||
$VBoxContainer/exit.connect("pressed", self, "quit_game")
|
||||
$VBoxContainer/start.connect("pressed", self, "start_game")
|
||||
$"VBoxContainer/load".connect("pressed", self, "load_game")
|
||||
$VBoxContainer/options.connect("pressed", self, "display_options")
|
||||
$VBoxContainer/development.connect("pressed", self, "display_development")
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
#func _process(delta):
|
||||
# pass
|
||||
78
proto2/ui/menu_root.tscn
Normal file
78
proto2/ui/menu_root.tscn
Normal file
@@ -0,0 +1,78 @@
|
||||
[gd_scene load_steps=4 format=2]
|
||||
|
||||
[ext_resource path="res://ui/menu_root.gd" type="Script" id=1]
|
||||
[ext_resource path="res://fonts/DroidSansFallback.ttf" type="DynamicFontData" id=2]
|
||||
|
||||
[sub_resource type="DynamicFont" id=1]
|
||||
size = 32
|
||||
font_data = ExtResource( 2 )
|
||||
|
||||
[node name="menu_root" type="Control"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
script = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
margin_left = -512.0
|
||||
margin_top = -125.5
|
||||
margin_right = 512.0
|
||||
margin_bottom = 125.5
|
||||
__meta__ = {
|
||||
"_edit_lock_": true
|
||||
}
|
||||
|
||||
[node name="start" type="Button" parent="VBoxContainer"]
|
||||
margin_right = 1024.0
|
||||
margin_bottom = 49.0
|
||||
custom_fonts/font = SubResource( 1 )
|
||||
text = "Start"
|
||||
__meta__ = {
|
||||
"_edit_lock_": true
|
||||
}
|
||||
|
||||
[node name="load" type="Button" parent="VBoxContainer"]
|
||||
margin_top = 53.0
|
||||
margin_right = 1024.0
|
||||
margin_bottom = 102.0
|
||||
custom_fonts/font = SubResource( 1 )
|
||||
text = "Load"
|
||||
__meta__ = {
|
||||
"_edit_lock_": true
|
||||
}
|
||||
|
||||
[node name="options" type="Button" parent="VBoxContainer"]
|
||||
margin_top = 106.0
|
||||
margin_right = 1024.0
|
||||
margin_bottom = 155.0
|
||||
custom_fonts/font = SubResource( 1 )
|
||||
text = "Options"
|
||||
__meta__ = {
|
||||
"_edit_lock_": true
|
||||
}
|
||||
|
||||
[node name="development" type="Button" parent="VBoxContainer"]
|
||||
margin_top = 159.0
|
||||
margin_right = 1024.0
|
||||
margin_bottom = 208.0
|
||||
custom_fonts/font = SubResource( 1 )
|
||||
text = "Development"
|
||||
__meta__ = {
|
||||
"_edit_lock_": true
|
||||
}
|
||||
|
||||
[node name="exit" type="Button" parent="VBoxContainer"]
|
||||
margin_top = 212.0
|
||||
margin_right = 1024.0
|
||||
margin_bottom = 261.0
|
||||
custom_fonts/font = SubResource( 1 )
|
||||
text = "Exit"
|
||||
__meta__ = {
|
||||
"_edit_lock_": true
|
||||
}
|
||||
Reference in New Issue
Block a user