🎉 initial commit

This commit is contained in:
anyreso 2024-04-07 14:25:59 -04:00
commit d02447c7e6
185 changed files with 8442 additions and 0 deletions

65
interfaces/hud/hud.tscn Normal file
View file

@ -0,0 +1,65 @@
[gd_scene load_steps=5 format=3 uid="uid://bcv81ku26xo"]
[sub_resource type="GDScript" id="GDScript_2vxif"]
script/source = "extends CanvasLayer
@onready var energy_bar = $EnergyBar
func _update_energy_label(energy):
energy_bar.value = energy
func _ready():
_update_energy_label(100.0)
func _on_energy_changed(new_energy) -> void:
_update_energy_label(new_energy)
"
[sub_resource type="Theme" id="Theme_irfqb"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_f23s3"]
bg_color = Color(0, 0.454902, 0.992157, 1)
[sub_resource type="GDScript" id="GDScript_w8l21"]
script/source = "extends Label
@onready var player = get_parent().owner
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(_delta):
text = \"\"
text += \"fps: %s\\n\" % str(Engine.get_frames_per_second())
text += \"position: %d, %d, %d\\n\" % [player.position.x, player.position.y, player.position.z]
text += \"speed: %d km/h\\n\" % (player.linear_velocity.length() * 3.6)
"
[node name="HUD" type="CanvasLayer"]
script = SubResource("GDScript_2vxif")
[node name="EnergyBar" type="ProgressBar" parent="."]
offset_left = 32.0
offset_top = 32.0
offset_right = 288.0
offset_bottom = 40.0
size_flags_horizontal = 0
mouse_filter = 2
theme = SubResource("Theme_irfqb")
theme_override_styles/fill = SubResource("StyleBoxFlat_f23s3")
value = 60.0
show_percentage = false
[node name="DebugLabel" type="Label" parent="."]
anchors_preset = 2
anchor_top = 1.0
anchor_bottom = 1.0
offset_left = 20.0
offset_top = -33.0
offset_right = 21.0
offset_bottom = -10.0
grow_vertical = 0
script = SubResource("GDScript_w8l21")

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://c1tjamjm8qjog"
path="res://.godot/imported/background.webp-f3f369ebd80fe0ef765a073acba84e0f.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://interfaces/menus/boot/background.webp"
dest_files=["res://.godot/imported/background.webp-f3f369ebd80fe0ef765a073acba84e0f.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

View file

@ -0,0 +1,86 @@
[gd_scene load_steps=5 format=3 uid="uid://bjctlqvs33nqy"]
[ext_resource type="Texture2D" uid="uid://c1tjamjm8qjog" path="res://interfaces/menus/boot/background.webp" id="1_ph586"]
[ext_resource type="PackedScene" uid="uid://1seg8cvss7a7" path="res://interfaces/menus/boot/multiplayer.tscn" id="2_lcb0h"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_snh7i"]
bg_color = Color(0, 0.5, 0.5, 0.25)
[sub_resource type="GDScript" id="GDScript_yqbr7"]
script/source = "extends PanelContainer
const PLAYER = preload(\"res://characters/player/player.tscn\")
const MAP = preload(\"res://maps/genesis/genesis.tscn\")
func _on_demo_pressed():
# instantiate scenes
var player = PLAYER.instantiate()
var map = MAP.instantiate()
# set player initial position
player.position = Vector3(0,150,0)
# add as siblings in tree
for o in [map, player]:
owner.add_sibling(o)
# queue main_menu node for deletion
owner.queue_free()
func _on_multiplayer_pressed():
hide()
owner.get_node(\"Multiplayer\").show()
func _on_quit_pressed():
get_tree().quit()
"
[node name="MainMenu" type="CanvasLayer"]
[node name="TextureRect" type="TextureRect" parent="."]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
mouse_filter = 2
texture = ExtResource("1_ph586")
stretch_mode = 6
[node name="Multiplayer" parent="." instance=ExtResource("2_lcb0h")]
visible = false
[node name="Main" type="PanelContainer" parent="."]
anchors_preset = 9
anchor_bottom = 1.0
offset_right = 313.0
grow_vertical = 2
size_flags_horizontal = 0
theme_override_styles/panel = SubResource("StyleBoxFlat_snh7i")
script = SubResource("GDScript_yqbr7")
[node name="MarginContainer" type="MarginContainer" parent="Main"]
layout_mode = 2
theme_override_constants/margin_left = 20
theme_override_constants/margin_right = 20
[node name="VBoxContainer" type="VBoxContainer" parent="Main/MarginContainer"]
layout_mode = 2
theme_override_constants/separation = 10
alignment = 1
[node name="Demo" type="Button" parent="Main/MarginContainer/VBoxContainer"]
layout_mode = 2
theme_override_font_sizes/font_size = 32
text = "Demo"
[node name="Multiplayer" type="Button" parent="Main/MarginContainer/VBoxContainer"]
layout_mode = 2
theme_override_font_sizes/font_size = 32
text = "Multiplayer"
[node name="Quit" type="Button" parent="Main/MarginContainer/VBoxContainer"]
layout_mode = 2
theme_override_font_sizes/font_size = 32
text = "Quit"
[connection signal="pressed" from="Main/MarginContainer/VBoxContainer/Demo" to="Main" method="_on_demo_pressed"]
[connection signal="pressed" from="Main/MarginContainer/VBoxContainer/Multiplayer" to="Main" method="_on_multiplayer_pressed"]
[connection signal="pressed" from="Main/MarginContainer/VBoxContainer/Quit" to="Main" method="_on_quit_pressed"]

View file

@ -0,0 +1,258 @@
[gd_scene load_steps=3 format=3 uid="uid://1seg8cvss7a7"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_krqeq"]
bg_color = Color(0.5, 0.5, 0.5, 0.25)
[sub_resource type="GDScript" id="GDScript_tc1bm"]
script/source = "extends PanelContainer
const MAX_CLIENTS : int = 20
const DEFAULT_PORT : int = 9000
const DEFAULT_HOST : String = \"localhost\"
var _join_address = RegEx.new()
var _registered_ports = RegEx.new()
func _ready():
# see https://datatracker.ietf.org/doc/html/rfc1700
_registered_ports.compile(r'^(?:102[4-9]|10[3-9]\\d|1[1-9]\\d{2}|[2-9]\\d{3}|[1-5]\\d{4}|6[0-4]\\d{3}|65[0-4]\\d{2}|655[0-2]\\d|6553[0-5])$')
_join_address.compile(r'^(?<host>[a-zA-Z0-9.-]+)(:(?<port>:102[4-9]|10[3-9]\\d|1[1-9]\\d{2}|[2-9]\\d{3}|[1-5]\\d{4}|6[0-4]\\d{3}|65[0-4]\\d{2}|655[0-2]\\d|6553[0-5]))?$')
hide() # start hidden
func _on_menu_pressed():
hide()
owner.get_node(\"Main\").show()
func _on_quit_pressed():
get_tree().quit()
func _on_join_pressed():
var addr = [DEFAULT_HOST, DEFAULT_PORT]
# validate join address input
var result = _join_address.search(%JoinAddress.text)
if result: # address is valid
addr[0] = result.get_string(\"host\")
var rport = result.get_string(\"port\")
if rport: addr[1] = int(rport)
# create client
var peer = ENetMultiplayerPeer.new()
peer.create_client(addr[0], addr[1])
multiplayer.multiplayer_peer = peer
func _on_host_pressed():
var port = DEFAULT_PORT
# check for registered ports number matches
if %ServerPort.text:
var result = _registered_ports.search(%ServerPort.text)
if result: # port is valid
port = int(result.get_string())
else: # port is not valid
push_warning(\"A valid port number in the range 1024-65535 is required.\")
return
# create server
var peer = ENetMultiplayerPeer.new()
peer.create_server(port, MAX_CLIENTS)
multiplayer.multiplayer_peer = peer
multiplayer.peer_connected.connect(_on_peer_connected)
func _on_peer_connected(peer_id):
print(\"Peer `%s` connected\" % peer_id)
"
[node name="Multiplayer" type="PanelContainer"]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme_override_styles/panel = SubResource("StyleBoxFlat_krqeq")
script = SubResource("GDScript_tc1bm")
[node name="MarginContainer" type="MarginContainer" parent="."]
layout_mode = 2
theme_override_constants/margin_left = 20
theme_override_constants/margin_top = 20
theme_override_constants/margin_right = 20
theme_override_constants/margin_bottom = 20
[node name="TabContainer" type="TabContainer" parent="MarginContainer"]
layout_mode = 2
theme_override_constants/side_margin = 0
[node name="Profile" type="TabBar" parent="MarginContainer/TabContainer"]
layout_mode = 2
theme_override_constants/h_separation = 0
[node name="MarginContainer" type="MarginContainer" parent="MarginContainer/TabContainer/Profile"]
layout_mode = 0
offset_right = 1116.0
offset_bottom = 577.0
theme_override_constants/margin_left = 20
theme_override_constants/margin_top = 20
theme_override_constants/margin_right = 20
theme_override_constants/margin_bottom = 20
[node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer/TabContainer/Profile/MarginContainer"]
layout_mode = 2
theme_override_constants/separation = 20
[node name="LeftBox" type="VBoxContainer" parent="MarginContainer/TabContainer/Profile/MarginContainer/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
size_flags_stretch_ratio = 0.25
[node name="Create" type="Button" parent="MarginContainer/TabContainer/Profile/MarginContainer/HBoxContainer/LeftBox"]
layout_mode = 2
disabled = true
text = "Create"
[node name="Delete" type="Button" parent="MarginContainer/TabContainer/Profile/MarginContainer/HBoxContainer/LeftBox"]
layout_mode = 2
disabled = true
text = "Delete"
[node name="Spacer" type="MarginContainer" parent="MarginContainer/TabContainer/Profile/MarginContainer/HBoxContainer/LeftBox"]
layout_mode = 2
size_flags_vertical = 3
[node name="Menu" type="Button" parent="MarginContainer/TabContainer/Profile/MarginContainer/HBoxContainer/LeftBox"]
layout_mode = 2
text = "Menu
"
[node name="Quit" type="Button" parent="MarginContainer/TabContainer/Profile/MarginContainer/HBoxContainer/LeftBox"]
layout_mode = 2
text = "Quit"
[node name="RightBox" type="VBoxContainer" parent="MarginContainer/TabContainer/Profile/MarginContainer/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
[node name="Label" type="Label" parent="MarginContainer/TabContainer/Profile/MarginContainer/HBoxContainer/RightBox"]
layout_mode = 2
text = "Current Profile:"
[node name="ProfileName" type="LineEdit" parent="MarginContainer/TabContainer/Profile/MarginContainer/HBoxContainer/RightBox"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
text = "Newblood"
[node name="Join" type="TabBar" parent="MarginContainer/TabContainer"]
visible = false
layout_mode = 2
select_with_rmb = true
[node name="MarginContainer" type="MarginContainer" parent="MarginContainer/TabContainer/Join"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme_override_constants/margin_left = 20
theme_override_constants/margin_top = 20
theme_override_constants/margin_right = 20
theme_override_constants/margin_bottom = 20
[node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer/TabContainer/Join/MarginContainer"]
layout_mode = 2
theme_override_constants/separation = 10
[node name="LeftBox" type="VBoxContainer" parent="MarginContainer/TabContainer/Join/MarginContainer/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
size_flags_stretch_ratio = 0.25
[node name="Join" type="Button" parent="MarginContainer/TabContainer/Join/MarginContainer/HBoxContainer/LeftBox"]
layout_mode = 2
text = "Join"
[node name="Spacer" type="MarginContainer" parent="MarginContainer/TabContainer/Join/MarginContainer/HBoxContainer/LeftBox"]
layout_mode = 2
size_flags_vertical = 3
[node name="Menu" type="Button" parent="MarginContainer/TabContainer/Join/MarginContainer/HBoxContainer/LeftBox"]
layout_mode = 2
text = "Menu
"
[node name="Quit" type="Button" parent="MarginContainer/TabContainer/Join/MarginContainer/HBoxContainer/LeftBox"]
layout_mode = 2
text = "Quit"
[node name="RightBox" type="VBoxContainer" parent="MarginContainer/TabContainer/Join/MarginContainer/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
[node name="JoinAddress" type="LineEdit" parent="MarginContainer/TabContainer/Join/MarginContainer/HBoxContainer/RightBox"]
unique_name_in_owner = true
layout_mode = 2
placeholder_text = "localhost"
[node name="Host" type="TabBar" parent="MarginContainer/TabContainer"]
visible = false
layout_mode = 2
select_with_rmb = true
[node name="MarginContainer" type="MarginContainer" parent="MarginContainer/TabContainer/Host"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme_override_constants/margin_left = 20
theme_override_constants/margin_top = 20
theme_override_constants/margin_right = 20
theme_override_constants/margin_bottom = 20
[node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer/TabContainer/Host/MarginContainer"]
layout_mode = 2
theme_override_constants/separation = 10
[node name="LeftBox" type="VBoxContainer" parent="MarginContainer/TabContainer/Host/MarginContainer/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
size_flags_stretch_ratio = 0.25
[node name="Host" type="Button" parent="MarginContainer/TabContainer/Host/MarginContainer/HBoxContainer/LeftBox"]
layout_mode = 2
text = "Host"
[node name="Spacer" type="MarginContainer" parent="MarginContainer/TabContainer/Host/MarginContainer/HBoxContainer/LeftBox"]
layout_mode = 2
size_flags_vertical = 3
[node name="Menu" type="Button" parent="MarginContainer/TabContainer/Host/MarginContainer/HBoxContainer/LeftBox"]
layout_mode = 2
text = "Menu
"
[node name="Quit" type="Button" parent="MarginContainer/TabContainer/Host/MarginContainer/HBoxContainer/LeftBox"]
layout_mode = 2
text = "Quit"
[node name="RightBox" type="VBoxContainer" parent="MarginContainer/TabContainer/Host/MarginContainer/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
[node name="ServerPort" type="LineEdit" parent="MarginContainer/TabContainer/Host/MarginContainer/HBoxContainer/RightBox"]
unique_name_in_owner = true
layout_mode = 2
placeholder_text = "9000"
[connection signal="pressed" from="MarginContainer/TabContainer/Profile/MarginContainer/HBoxContainer/LeftBox/Menu" to="." method="_on_menu_pressed"]
[connection signal="pressed" from="MarginContainer/TabContainer/Profile/MarginContainer/HBoxContainer/LeftBox/Quit" to="." method="_on_quit_pressed"]
[connection signal="pressed" from="MarginContainer/TabContainer/Join/MarginContainer/HBoxContainer/LeftBox/Join" to="." method="_on_join_pressed"]
[connection signal="pressed" from="MarginContainer/TabContainer/Join/MarginContainer/HBoxContainer/LeftBox/Menu" to="." method="_on_menu_pressed"]
[connection signal="pressed" from="MarginContainer/TabContainer/Join/MarginContainer/HBoxContainer/LeftBox/Quit" to="." method="_on_quit_pressed"]
[connection signal="pressed" from="MarginContainer/TabContainer/Host/MarginContainer/HBoxContainer/LeftBox/Host" to="." method="_on_host_pressed"]
[connection signal="pressed" from="MarginContainer/TabContainer/Host/MarginContainer/HBoxContainer/LeftBox/Menu" to="." method="_on_menu_pressed"]
[connection signal="pressed" from="MarginContainer/TabContainer/Host/MarginContainer/HBoxContainer/LeftBox/Quit" to="." method="_on_quit_pressed"]
[connection signal="text_changed" from="MarginContainer/TabContainer/Host/MarginContainer/HBoxContainer/RightBox/ServerPort" to="MarginContainer/TabContainer/Host/MarginContainer/HBoxContainer/RightBox/ServerPort" method="_on_text_changed"]