diff --git a/.gitignore b/.gitignore index 0e3fbb1..57ae9d7 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,6 @@ /bin/ /build/ /lib/ -/git_api.* *.translation export_presets.cfg +mono_crash.* diff --git a/.vscode/settings.json b/.vscode/settings.json index d0964bf..af8c495 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -5,4 +5,8 @@ "files.trimTrailingWhitespace": true, "files.trimFinalNewlines": true, "files.insertFinalNewline": true, + + "[markdown]": { + "files.trimTrailingWhitespace": false, + } } diff --git a/CREDITS.md b/CREDITS.md new file mode 100644 index 0000000..9feccdf --- /dev/null +++ b/CREDITS.md @@ -0,0 +1,9 @@ +# Assets + +## Heartbit Font + +**URL:** https://arcade.itch.io/heartbit +**Author:** Void +**License:** Custom +> You can use this font in free and personal projects, works or games. +> You'll need to pay the suggested price for commercial projects. diff --git a/GameScene.tscn b/GameScene.tscn deleted file mode 100644 index ee386ff..0000000 --- a/GameScene.tscn +++ /dev/null @@ -1,105 +0,0 @@ -[gd_scene load_steps=6 format=2] - -[ext_resource path="res://Player.tscn" type="PackedScene" id=1] -[ext_resource path="res://gfx/cursor.png" type="Texture" id=2] -[ext_resource path="res://Block.tscn" type="PackedScene" id=3] -[ext_resource path="res://Game.cs" type="Script" id=4] -[ext_resource path="res://Cursor.cs" type="Script" id=5] - -[node name="Game" type="Node"] -script = ExtResource( 4 ) -Player = ExtResource( 1 ) -Block = ExtResource( 3 ) - -[node name="Cursor" type="Node2D" parent="."] -z_index = 4096 -script = ExtResource( 5 ) -__meta__ = { -"_edit_group_": true -} - -[node name="Sprite" type="Sprite" parent="Cursor"] -texture = ExtResource( 2 ) - -[node name="HUD" type="CanvasLayer" parent="."] - -[node name="Menu" type="CenterContainer" parent="HUD"] -visible = false -anchor_right = 1.0 -anchor_bottom = 1.0 -__meta__ = { -"_edit_use_anchors_": false -} - -[node name="Panel" type="PanelContainer" parent="HUD/Menu"] -margin_left = 633.0 -margin_top = 353.0 -margin_right = 647.0 -margin_bottom = 367.0 - -[node name="VBoxContainer" type="VBoxContainer" parent="HUD/Menu/Panel"] -margin_left = 7.0 -margin_top = 7.0 -margin_right = 175.0 -margin_bottom = 113.0 -__meta__ = { -"_edit_use_anchors_": false -} - -[node name="Label" type="Label" parent="HUD/Menu/Panel/VBoxContainer"] -margin_right = 168.0 -margin_bottom = 14.0 -text = "Menu" -align = 1 -__meta__ = { -"_edit_use_anchors_": false -} - -[node name="HSeparator" type="HSeparator" parent="HUD/Menu/Panel/VBoxContainer"] -margin_top = 18.0 -margin_right = 168.0 -margin_bottom = 22.0 - -[node name="StartServer" type="Button" parent="HUD/Menu/Panel/VBoxContainer"] -margin_top = 26.0 -margin_right = 168.0 -margin_bottom = 46.0 -text = "Start Server" -__meta__ = { -"_edit_use_anchors_": false -} - -[node name="HBoxContainer2" type="HBoxContainer" parent="HUD/Menu/Panel/VBoxContainer"] -margin_top = 50.0 -margin_right = 168.0 -margin_bottom = 74.0 - -[node name="Address" type="LineEdit" parent="HUD/Menu/Panel/VBoxContainer/HBoxContainer2"] -margin_right = 100.0 -margin_bottom = 24.0 -rect_min_size = Vector2( 100, 0 ) -caret_blink = true - -[node name="Connect" type="Button" parent="HUD/Menu/Panel/VBoxContainer/HBoxContainer2"] -margin_left = 104.0 -margin_right = 168.0 -margin_bottom = 24.0 -text = "Connect" - -[node name="Disconnect" type="Button" parent="HUD/Menu/Panel/VBoxContainer"] -visible = false -margin_top = 78.0 -margin_right = 168.0 -margin_bottom = 98.0 -text = "Disconnect" - -[node name="HSeparator2" type="HSeparator" parent="HUD/Menu/Panel/VBoxContainer"] -margin_top = 78.0 -margin_right = 168.0 -margin_bottom = 82.0 - -[node name="BackToGame" type="Button" parent="HUD/Menu/Panel/VBoxContainer"] -margin_top = 86.0 -margin_right = 168.0 -margin_bottom = 106.0 -text = "Back to Game" diff --git a/HeartbitXX.ttf b/HeartbitXX.ttf new file mode 100644 index 0000000..71ff9ad Binary files /dev/null and b/HeartbitXX.ttf differ diff --git a/project.godot b/project.godot index 60508e5..9494eea 100644 --- a/project.godot +++ b/project.godot @@ -8,20 +8,15 @@ config_version=4 -_global_script_classes=[ { -"base": "", -"class": "GitAPI", -"language": "NativeScript", -"path": "res://git_api.gdns" -} ] +_global_script_classes=[ ] _global_script_class_icons={ -"GitAPI": "" + } [application] config/name="YourfortV" -run/main_scene="res://GameScene.tscn" +run/main_scene="res://scene/GameScene.tscn" config/icon="res://gfx/icon.png" [display] @@ -32,7 +27,7 @@ window/stretch/mode="viewport" [gdnative] -singletons=[ "res://git_api.gdnlib" ] +singletons=[ ] [importer_defaults] @@ -59,6 +54,12 @@ texture={ [input] +ui_menu={ +"deadzone": 0.5, +"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777217,"unicode":0,"echo":false,"script":null) +, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":11,"pressure":0.0,"pressed":false,"script":null) + ] +} move_left={ "deadzone": 0.5, "events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":65,"unicode":0,"echo":false,"script":null) diff --git a/Block.tscn b/scene/Block.tscn similarity index 100% rename from Block.tscn rename to scene/Block.tscn diff --git a/scene/EscapeMenu.tscn b/scene/EscapeMenu.tscn new file mode 100644 index 0000000..a89714f --- /dev/null +++ b/scene/EscapeMenu.tscn @@ -0,0 +1,228 @@ +[gd_scene load_steps=3 format=2] + +[ext_resource path="res://ui_theme.tres" type="Theme" id=1] +[ext_resource path="res://src/EscapeMenu.cs" type="Script" id=2] + +[node name="EscapeMenu" type="Container"] +anchor_right = 1.0 +anchor_bottom = 1.0 +theme = ExtResource( 1 ) +script = ExtResource( 2 ) +__meta__ = { +"_edit_use_anchors_": false +} +StatusPath = NodePath("CenterContainer/PanelContainer/VBoxContainer/ContainerStatus/Status") +ServerStartStopPath = NodePath("CenterContainer/PanelContainer/VBoxContainer/ContainerServer/ServerStartStop") +ServerPortPath = NodePath("CenterContainer/PanelContainer/VBoxContainer/ContainerServer/ServerPort") +ClientDisConnectPath = NodePath("CenterContainer/PanelContainer/VBoxContainer/ContainerClient/ClientDisConnect") +ClientAddressPath = NodePath("CenterContainer/PanelContainer/VBoxContainer/ContainerClient/ClientAddress") +ReturnPath = NodePath("CenterContainer/PanelContainer/VBoxContainer/Return") + +[node name="ColorRect" type="ColorRect" parent="."] +anchor_right = 1.0 +anchor_bottom = 1.0 +color = Color( 0, 0, 0, 0.501961 ) + +[node name="CenterContainer" type="CenterContainer" parent="."] +anchor_right = 1.0 +anchor_bottom = 1.0 + +[node name="PanelContainer" type="PanelContainer" parent="CenterContainer"] +margin_left = 527.0 +margin_top = 274.0 +margin_right = 752.0 +margin_bottom = 446.0 + +[node name="VBoxContainer" type="VBoxContainer" parent="CenterContainer/PanelContainer"] +margin_left = 7.0 +margin_top = 7.0 +margin_right = 218.0 +margin_bottom = 165.0 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Label" type="Label" parent="CenterContainer/PanelContainer/VBoxContainer"] +margin_right = 211.0 +margin_bottom = 9.0 +text = "Pause Menu" +align = 1 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="HSeparator" type="HSeparator" parent="CenterContainer/PanelContainer/VBoxContainer"] +margin_top = 13.0 +margin_right = 211.0 +margin_bottom = 17.0 + +[node name="ContainerStatus" type="HBoxContainer" parent="CenterContainer/PanelContainer/VBoxContainer"] +margin_top = 21.0 +margin_right = 211.0 +margin_bottom = 34.0 + +[node name="Label" type="Label" parent="CenterContainer/PanelContainer/VBoxContainer/ContainerStatus"] +margin_top = 2.0 +margin_right = 36.0 +margin_bottom = 11.0 +rect_min_size = Vector2( 36, 0 ) +text = "Status:" +align = 2 + +[node name="Status" type="Label" parent="CenterContainer/PanelContainer/VBoxContainer/ContainerStatus"] +margin_left = 40.0 +margin_right = 211.0 +margin_bottom = 13.0 +rect_min_size = Vector2( 0, 13 ) +size_flags_horizontal = 3 +size_flags_vertical = 5 +text = "No Connection" +align = 1 +valign = 1 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="ContainerServer" type="HBoxContainer" parent="CenterContainer/PanelContainer/VBoxContainer"] +margin_top = 38.0 +margin_right = 211.0 +margin_bottom = 57.0 + +[node name="Label" type="Label" parent="CenterContainer/PanelContainer/VBoxContainer/ContainerServer"] +margin_top = 5.0 +margin_right = 36.0 +margin_bottom = 14.0 +rect_min_size = Vector2( 36, 0 ) +text = "Port:" +align = 2 + +[node name="ServerPort" type="LineEdit" parent="CenterContainer/PanelContainer/VBoxContainer/ContainerServer"] +margin_left = 40.0 +margin_right = 90.0 +margin_bottom = 19.0 +custom_constants/minimum_spaces = 8 +align = 1 +max_length = 6 +caret_blink = true +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="ServerStartStop" type="Button" parent="CenterContainer/PanelContainer/VBoxContainer/ContainerServer"] +margin_left = 94.0 +margin_right = 211.0 +margin_bottom = 19.0 +size_flags_horizontal = 3 +text = "Start Server" +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="ContainerClient" type="HBoxContainer" parent="CenterContainer/PanelContainer/VBoxContainer"] +margin_top = 61.0 +margin_right = 211.0 +margin_bottom = 80.0 + +[node name="Label" type="Label" parent="CenterContainer/PanelContainer/VBoxContainer/ContainerClient"] +margin_top = 5.0 +margin_right = 36.0 +margin_bottom = 14.0 +rect_min_size = Vector2( 36, 0 ) +text = "Address:" +align = 2 + +[node name="ClientAddress" type="LineEdit" parent="CenterContainer/PanelContainer/VBoxContainer/ContainerClient"] +margin_left = 40.0 +margin_right = 160.0 +margin_bottom = 19.0 +rect_min_size = Vector2( 120, 0 ) +align = 1 +caret_blink = true + +[node name="ClientDisConnect" type="Button" parent="CenterContainer/PanelContainer/VBoxContainer/ContainerClient"] +margin_left = 164.0 +margin_right = 211.0 +margin_bottom = 19.0 +size_flags_horizontal = 3 +text = "Connect" + +[node name="HBoxContainer" type="HBoxContainer" parent="CenterContainer/PanelContainer/VBoxContainer"] +margin_top = 84.0 +margin_right = 211.0 +margin_bottom = 108.0 + +[node name="HideAddress" type="CheckBox" parent="CenterContainer/PanelContainer/VBoxContainer/HBoxContainer"] +margin_right = 82.0 +margin_bottom = 24.0 +text = "Hide Address" + +[node name="Label" type="Label" parent="CenterContainer/PanelContainer/VBoxContainer/HBoxContainer"] +margin_left = 86.0 +margin_top = 7.0 +margin_right = 173.0 +margin_bottom = 16.0 +custom_colors/font_color = Color( 0.6, 0.6, 0.6, 1 ) +text = "(for streamers etc.)" + +[node name="HSeparator2" type="HSeparator" parent="CenterContainer/PanelContainer/VBoxContainer"] +margin_top = 112.0 +margin_right = 211.0 +margin_bottom = 116.0 + +[node name="Quit" type="Button" parent="CenterContainer/PanelContainer/VBoxContainer"] +margin_top = 120.0 +margin_right = 211.0 +margin_bottom = 137.0 +rect_min_size = Vector2( 0, 17 ) + +[node name="RichTextLabel" type="RichTextLabel" parent="CenterContainer/PanelContainer/VBoxContainer/Quit"] +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +margin_left = -105.5 +margin_top = -5.0 +margin_right = 105.5 +margin_bottom = 5.0 +mouse_filter = 1 +bbcode_enabled = true +bbcode_text = "[center]Quit Game [color=#999](Alt+F4)[/color][/center]" +text = "Quit Game (Alt+F4)" +fit_content_height = true +scroll_active = false +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Return" type="Button" parent="CenterContainer/PanelContainer/VBoxContainer"] +margin_top = 141.0 +margin_right = 211.0 +margin_bottom = 158.0 +rect_min_size = Vector2( 0, 17 ) +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="RichTextLabel" type="RichTextLabel" parent="CenterContainer/PanelContainer/VBoxContainer/Return"] +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +margin_left = -105.5 +margin_top = -5.0 +margin_right = 105.5 +margin_bottom = 5.0 +mouse_filter = 1 +bbcode_enabled = true +bbcode_text = "[center]Return to Game [color=#999](Esc)[/color][/center]" +text = "Return to Game (Esc)" +fit_content_height = true +scroll_active = false +__meta__ = { +"_edit_use_anchors_": false +} +[connection signal="pressed" from="CenterContainer/PanelContainer/VBoxContainer/ContainerServer/ServerStartStop" to="." method="_on_ServerStartStop_pressed"] +[connection signal="pressed" from="CenterContainer/PanelContainer/VBoxContainer/ContainerClient/ClientDisConnect" to="." method="_on_ClientDisConnect_pressed"] +[connection signal="toggled" from="CenterContainer/PanelContainer/VBoxContainer/HBoxContainer/HideAddress" to="." method="_on_HideAddress_toggled"] +[connection signal="pressed" from="CenterContainer/PanelContainer/VBoxContainer/Quit" to="." method="_on_Quit_pressed"] +[connection signal="pressed" from="CenterContainer/PanelContainer/VBoxContainer/Return" to="." method="_on_Return_pressed"] diff --git a/scene/GameScene.tscn b/scene/GameScene.tscn new file mode 100644 index 0000000..cee58f2 --- /dev/null +++ b/scene/GameScene.tscn @@ -0,0 +1,27 @@ +[gd_scene load_steps=7 format=2] + +[ext_resource path="res://scene/EscapeMenu.tscn" type="PackedScene" id=1] +[ext_resource path="res://src/Cursor.cs" type="Script" id=2] +[ext_resource path="res://src/Game.cs" type="Script" id=3] +[ext_resource path="res://gfx/cursor.png" type="Texture" id=4] +[ext_resource path="res://scene/Player.tscn" type="PackedScene" id=5] +[ext_resource path="res://scene/Block.tscn" type="PackedScene" id=6] + +[node name="Game" type="Node"] +script = ExtResource( 3 ) +Player = ExtResource( 5 ) +Block = ExtResource( 6 ) + +[node name="HUD" type="CanvasLayer" parent="."] + +[node name="Cursor" type="Node2D" parent="HUD"] +pause_mode = 2 +z_index = 1 +script = ExtResource( 2 ) + +[node name="Sprite" type="Sprite" parent="HUD/Cursor"] +texture = ExtResource( 4 ) + +[node name="EscapeMenu" parent="HUD" instance=ExtResource( 1 )] +pause_mode = 2 +visible = false diff --git a/Player.tscn b/scene/Player.tscn similarity index 81% rename from Player.tscn rename to scene/Player.tscn index 0f070aa..26e90bb 100644 --- a/Player.tscn +++ b/scene/Player.tscn @@ -1,8 +1,8 @@ [gd_scene load_steps=5 format=2] -[ext_resource path="res://Camera.cs" type="Script" id=1] +[ext_resource path="res://src/Camera.cs" type="Script" id=1] [ext_resource path="res://gfx/player.png" type="Texture" id=2] -[ext_resource path="res://Player.cs" type="Script" id=3] +[ext_resource path="res://src/Player.cs" type="Script" id=3] [sub_resource type="CircleShape2D" id=1] radius = 8.0 diff --git a/Camera.cs b/src/Camera.cs similarity index 90% rename from Camera.cs rename to src/Camera.cs index 65f4cea..bd3b53e 100644 --- a/Camera.cs +++ b/src/Camera.cs @@ -6,7 +6,7 @@ public class Camera : Camera2D public override void _EnterTree() { - Cursor = GetViewport().GetNode("Cursor"); + // Cursor = GetViewport().GetNode("Cursor"); } public override void _Process(float delta) diff --git a/Cursor.cs b/src/Cursor.cs similarity index 100% rename from Cursor.cs rename to src/Cursor.cs diff --git a/src/EscapeMenu.cs b/src/EscapeMenu.cs new file mode 100644 index 0000000..4e40430 --- /dev/null +++ b/src/EscapeMenu.cs @@ -0,0 +1,80 @@ +using Godot; + +public class EscapeMenu : Container +{ + [Export] public int DefaultPort { get; set; } = 25565; + [Export] public string DefaultAddress { get; set; } = "localhost"; + + [Export] public NodePath StatusPath { get; set; } + [Export] public NodePath ServerStartStopPath { get; set; } + [Export] public NodePath ServerPortPath { get; set; } + [Export] public NodePath ClientDisConnectPath { get; set; } + [Export] public NodePath ClientAddressPath { get; set; } + [Export] public NodePath ReturnPath { get; set; } + + public Label Status { get; private set; } + public Button ServerStartStop { get; private set; } + public LineEdit ServerPort { get; private set; } + public Button ClientDisConnect { get; private set; } + public LineEdit ClientAddress { get; private set; } + public Button Return { get; private set; } + + public override void _EnterTree() + { + Status = GetNode