The escape menu pauses the game and will allow for creating and connecting to multiplayer games. - Move scenes to scene/ folder - Move scripts to src/ folder - Add Hearbit font and CREDITS.md - Remove git integration (we have VS Code)main
parent
56fdb1ddcd
commit
e1ecd7f01e
16 changed files with 387 additions and 119 deletions
@ -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. |
@ -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" |
Binary file not shown.
@ -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"] |
@ -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 |
@ -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 |
@ -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<Label>(StatusPath); |
||||
ServerStartStop = GetNode<Button>(ServerStartStopPath); |
||||
ServerPort = GetNode<LineEdit>(ServerPortPath); |
||||
ClientDisConnect = GetNode<Button>(ClientDisConnectPath); |
||||
ClientAddress = GetNode<LineEdit>(ClientAddressPath); |
||||
Return = GetNode<Button>(ReturnPath); |
||||
|
||||
ServerPort.PlaceholderText = DefaultPort.ToString(); |
||||
ClientAddress.PlaceholderText = $"{DefaultAddress}:{DefaultPort}"; |
||||
} |
||||
|
||||
public override void _Input(InputEvent @event) |
||||
{ |
||||
if (@event.IsActionPressed("ui_menu")) Toggle(); |
||||
} |
||||
|
||||
public void Toggle() |
||||
{ |
||||
if (Visible) Close(); |
||||
else Open(); |
||||
} |
||||
|
||||
public void Open() |
||||
{ |
||||
if (Visible) return; |
||||
GetTree().Paused = true; |
||||
Return.GrabFocus(); |
||||
Visible = true; |
||||
} |
||||
|
||||
public void Close() |
||||
{ |
||||
if (!Visible) return; |
||||
GetTree().Paused = false; |
||||
Visible = false; |
||||
} |
||||
|
||||
#pragma warning disable IDE0051 |
||||
#pragma warning disable IDE1006 |
||||
|
||||
private void _on_ServerStartStop_pressed() |
||||
{ |
||||
|
||||
} |
||||
|
||||
private void _on_ClientDisConnect_pressed() |
||||
{ |
||||
|
||||
} |
||||
|
||||
private void _on_HideAddress_toggled(bool pressed) |
||||
=> ClientAddress.Secret = pressed; |
||||
private void _on_Quit_pressed() |
||||
=> GetTree().Quit(); |
||||
private void _on_Return_pressed() |
||||
=> Close(); |
||||
} |
@ -0,0 +1,24 @@ |
||||
[gd_resource type="Theme" load_steps=3 format=2] |
||||
|
||||
[ext_resource path="res://HeartbitXX.ttf" type="DynamicFontData" id=1] |
||||
|
||||
[sub_resource type="DynamicFont" id=1] |
||||
outline_size = 1 |
||||
outline_color = Color( 0, 0, 0, 1 ) |
||||
extra_spacing_top = -3 |
||||
extra_spacing_bottom = -1 |
||||
font_data = ExtResource( 1 ) |
||||
|
||||
[resource] |
||||
default_font = SubResource( 1 ) |
||||
Button/colors/font_color = Color( 0.88, 0.88, 0.88, 1 ) |
||||
Button/colors/font_color_disabled = Color( 0.9, 0.9, 0.9, 0.2 ) |
||||
Button/colors/font_color_hover = Color( 0.94, 0.94, 0.94, 1 ) |
||||
Button/colors/font_color_pressed = Color( 1, 1, 1, 1 ) |
||||
Button/constants/hseparation = 2 |
||||
Button/fonts/font = null |
||||
Button/styles/disabled = null |
||||
Button/styles/focus = null |
||||
Button/styles/hover = null |
||||
Button/styles/normal = null |
||||
Button/styles/pressed = null |
Loading…
Reference in new issue