Add main menu

soundtrack
Ensar Sarajčić 2021-11-13 00:03:35 +01:00
parent 197f78c589
commit 07a318c327
11 changed files with 292 additions and 15 deletions

Binary file not shown.

View File

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

View File

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/tyretexture.png-6d884bbccb42f565816a0d969c326a0d.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/source/tyretexture.png"
dest_files=[ "res://.import/tyretexture.png-6d884bbccb42f565816a0d969c326a0d.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

10
player/camera.tscn 100644
View File

@ -0,0 +1,10 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://player/camera.gd" type="Script" id=1]
[node name="camera" type="Camera"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 5.88022, 23.0639 )
far = 457.7
script = ExtResource( 1 )
target_distance = 12.0
target_height = 6.0

View File

@ -11,7 +11,7 @@ config_version=4
[application]
config/name="bugged-racing"
run/main_scene="res://scenes/test_level.tscn"
run/main_scene="res://scenes/menu/main_menu.tscn"
config/icon="res://icon.png"
[input]

View File

@ -0,0 +1,10 @@
extends Panel
func _on_StartButton_pressed() -> void:
get_tree().change_scene("res://scenes/menu/start_menu.tscn")
func _on_ExitButton_pressed() -> void:
get_tree().quit()
func _on_SettingsButton_pressed() -> void:
get_tree().change_scene("res://scenes/menu/settings_menu.tscn")

View File

@ -0,0 +1,80 @@
[gd_scene load_steps=5 format=2]
[ext_resource path="res://scenes/menu/main_menu.gd" type="Script" id=1]
[ext_resource path="res://assets/fonts/kenney-future-narrow.ttf" type="DynamicFontData" id=2]
[sub_resource type="DynamicFont" id=1]
size = 64
font_data = ExtResource( 2 )
[sub_resource type="DynamicFont" id=2]
size = 32
font_data = ExtResource( 2 )
[node name="MainMenu" type="Panel"]
anchor_right = 1.0
anchor_bottom = 1.0
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="MarginContainer" type="MarginContainer" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = 21.0
margin_top = 19.0
margin_right = -19.0
margin_bottom = -21.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="VSplitContainer" type="VSplitContainer" parent="MarginContainer"]
margin_right = 984.0
margin_bottom = 560.0
dragger_visibility = 1
[node name="Title" type="Label" parent="MarginContainer/VSplitContainer"]
margin_right = 984.0
margin_bottom = 72.0
custom_colors/font_color = Color( 0.419608, 0.0117647, 0.0117647, 1 )
custom_fonts/font = SubResource( 1 )
text = "Bugged Racing"
align = 1
valign = 1
[node name="CenterContainer" type="CenterContainer" parent="MarginContainer/VSplitContainer"]
margin_top = 84.0
margin_right = 984.0
margin_bottom = 560.0
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/VSplitContainer/CenterContainer"]
margin_left = 404.0
margin_top = 171.0
margin_right = 580.0
margin_bottom = 305.0
[node name="StartButton" type="Button" parent="MarginContainer/VSplitContainer/CenterContainer/VBoxContainer"]
margin_right = 176.0
margin_bottom = 42.0
custom_fonts/font = SubResource( 2 )
text = "Start"
[node name="SettingsButton" type="Button" parent="MarginContainer/VSplitContainer/CenterContainer/VBoxContainer"]
margin_top = 46.0
margin_right = 176.0
margin_bottom = 88.0
custom_fonts/font = SubResource( 2 )
text = "Settings"
[node name="ExitButton" type="Button" parent="MarginContainer/VSplitContainer/CenterContainer/VBoxContainer"]
margin_top = 92.0
margin_right = 176.0
margin_bottom = 134.0
custom_fonts/font = SubResource( 2 )
text = "Exit"
[connection signal="pressed" from="MarginContainer/VSplitContainer/CenterContainer/VBoxContainer/StartButton" to="." method="_on_StartButton_pressed"]
[connection signal="pressed" from="MarginContainer/VSplitContainer/CenterContainer/VBoxContainer/SettingsButton" to="." method="_on_SettingsButton_pressed"]
[connection signal="pressed" from="MarginContainer/VSplitContainer/CenterContainer/VBoxContainer/ExitButton" to="." method="_on_ExitButton_pressed"]

View File

@ -0,0 +1,20 @@
extends Panel
const buggy = preload("res://vehicles/buggy.tscn")
const beetle = preload("res://vehicles/beetlecar.tscn")
const test_scene = preload("res://scenes/test_level.tscn")
func _on_BuggyButton_pressed() -> void:
_start_with_vehicle(buggy.instance())
func _on_BeetleButton_pressed() -> void:
_start_with_vehicle(beetle.instance())
func _start_with_vehicle(vehicle: Node) -> void:
var scene = test_scene.instance()
scene.call_deferred("spawn_player", vehicle)
get_tree().root.call_deferred("add_child", scene)
queue_free()
func _on_BackButton_pressed() -> void:
get_tree().change_scene("res://scenes/menu/main_menu.tscn")

View File

@ -0,0 +1,80 @@
[gd_scene load_steps=5 format=2]
[ext_resource path="res://assets/fonts/kenney-future-narrow.ttf" type="DynamicFontData" id=1]
[ext_resource path="res://scenes/menu/start_menu.gd" type="Script" id=2]
[sub_resource type="DynamicFont" id=1]
size = 64
font_data = ExtResource( 1 )
[sub_resource type="DynamicFont" id=2]
size = 32
font_data = ExtResource( 1 )
[node name="StartMenu" type="Panel"]
anchor_right = 1.0
anchor_bottom = 1.0
script = ExtResource( 2 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="MarginContainer" type="MarginContainer" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = 20.0
margin_top = 20.0
margin_right = -20.0
margin_bottom = -20.0
[node name="VSplitContainer" type="VSplitContainer" parent="MarginContainer"]
margin_right = 984.0
margin_bottom = 560.0
dragger_visibility = 1
[node name="HSplitContainer" type="HSplitContainer" parent="MarginContainer/VSplitContainer"]
margin_right = 984.0
margin_bottom = 72.0
dragger_visibility = 1
[node name="BackButton" type="Button" parent="MarginContainer/VSplitContainer/HSplitContainer"]
margin_right = 42.0
margin_bottom = 72.0
text = "Back"
[node name="Title" type="Label" parent="MarginContainer/VSplitContainer/HSplitContainer"]
margin_left = 54.0
margin_right = 984.0
margin_bottom = 72.0
custom_fonts/font = SubResource( 1 )
text = "Select Vehicle"
align = 1
valign = 1
[node name="CenterContainer" type="CenterContainer" parent="MarginContainer/VSplitContainer"]
margin_top = 84.0
margin_right = 984.0
margin_bottom = 560.0
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/VSplitContainer/CenterContainer"]
margin_left = 419.0
margin_top = 194.0
margin_right = 565.0
margin_bottom = 282.0
[node name="BuggyButton" type="Button" parent="MarginContainer/VSplitContainer/CenterContainer/VBoxContainer"]
margin_right = 146.0
margin_bottom = 42.0
custom_fonts/font = SubResource( 2 )
text = "Buggy"
[node name="BeetleButton" type="Button" parent="MarginContainer/VSplitContainer/CenterContainer/VBoxContainer"]
margin_top = 46.0
margin_right = 146.0
margin_bottom = 88.0
custom_fonts/font = SubResource( 2 )
text = "Beetle"
[connection signal="pressed" from="MarginContainer/VSplitContainer/HSplitContainer/BackButton" to="." method="_on_BackButton_pressed"]
[connection signal="pressed" from="MarginContainer/VSplitContainer/CenterContainer/VBoxContainer/BuggyButton" to="." method="_on_BuggyButton_pressed"]
[connection signal="pressed" from="MarginContainer/VSplitContainer/CenterContainer/VBoxContainer/BeetleButton" to="." method="_on_BeetleButton_pressed"]

View File

@ -0,0 +1,15 @@
extends Spatial
const camera = preload("res://player/camera.tscn")
onready var spawn_point = $PlayerSpawnLocation
var player_node: Node
func _ready() -> void:
player_node.global_transform = spawn_point.global_transform
add_child(player_node)
var player_camera = camera.instance()
player_camera.follow_target_path = player_node.get_path()
add_child(player_camera)
func spawn_player(player_node: Node) -> void:
self.player_node = player_node

View File

@ -1,7 +1,6 @@
[gd_scene load_steps=11 format=2]
[gd_scene load_steps=10 format=2]
[ext_resource path="res://vehicles/buggy.tscn" type="PackedScene" id=1]
[ext_resource path="res://player/camera.gd" type="Script" id=2]
[ext_resource path="res://scenes/test_level.gd" type="Script" id=1]
[ext_resource path="res://icon.png" type="Texture" id=3]
[sub_resource type="PlaneMesh" id=1]
@ -36,6 +35,10 @@ albedo_color = Color( 0.4, 0.301961, 0.00784314, 1 )
albedo_texture = SubResource( 6 )
[node name="Spatial" type="Spatial"]
script = ExtResource( 1 )
[node name="PlayerSpawnLocation" type="Spatial" parent="."]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -53.0538, 4.97082, -42.7552 )
[node name="StaticBody" type="StaticBody" parent="."]
transform = Transform( 99.9785, 0, 0, 0, 99.9785, 0, 0, 0, 99.9785, 0, 0, 0 )
@ -49,14 +52,6 @@ material/0 = SubResource( 2 )
transform = Transform( 6.13726, 0, 0, 0, 6.13726, 0, 0, 0, 6.13726, 0, 0, 0 )
shape = SubResource( 3 )
[node name="camera" type="Camera" parent="."]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 5.88022, 23.0639 )
far = 457.7
script = ExtResource( 2 )
follow_target_path = NodePath("../buggy")
target_distance = 12.0
target_height = 6.0
[node name="Track" type="Spatial" parent="."]
[node name="Path" type="Path" parent="Track"]
@ -93,6 +88,3 @@ path_local = true
path_continuous_u = true
path_u_distance = 1.0
path_joined = true
[node name="buggy" parent="." instance=ExtResource( 1 )]
transform = Transform( 1.00456, 0, 0, 0, 1.00456, 0, 0, 0, 1.00456, 1.37925, -2.38419e-07, -5.16015 )