forked from drraccoon/GD-Polo
Inital commit
This commit is contained in:
parent
22733e2780
commit
068753a961
602 changed files with 5967 additions and 0 deletions
51
scenes/menu.gd
Normal file
51
scenes/menu.gd
Normal file
|
@ -0,0 +1,51 @@
|
|||
extends Control
|
||||
|
||||
var host_port = 2675
|
||||
var host_playermax = 2
|
||||
var ip = "127.0.0.1"
|
||||
var port = 2670
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
var myip = IP.get_local_addresses()
|
||||
var interfaces = IP.get_local_interfaces ()
|
||||
$HostPanel/label_myip.text = "IP "+myip[0]+". "+interfaces[0]
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
#func _process(delta):
|
||||
# pass
|
||||
|
||||
|
||||
func _on_singleplayer_button_up():
|
||||
var _letsgo = get_tree().change_scene("res://world_scenes/World.tscn")
|
||||
|
||||
|
||||
func _on_JoinGameBtn_button_up():
|
||||
ip = $JoinPanel/join_ip
|
||||
port = $JoinPanel/join_port
|
||||
print("Attempting to join game at IP ",ip," via port ",port)
|
||||
join_game()
|
||||
|
||||
func _on_HostGameBtn_button_up():
|
||||
#var host_port = $HostPanel/host_port.text
|
||||
print("Attempting to host game on port ",host_port,"...")
|
||||
host_game(host_port)
|
||||
|
||||
func host_game(port):
|
||||
var host = NetworkedMultiplayerENet.new()
|
||||
host.create_server(port)
|
||||
get_tree().set_network_peer(host)
|
||||
print("Hosting on port ",host_port)
|
||||
$HostPanel/HostGameBtn.disabled = 1
|
||||
$HostPanel/HostGameBtn.hint_tooltip = "Cannot start another server, Server already started."
|
||||
$JoinPanel/JoinGameBtn.disabled = 1
|
||||
$JoinPanel/JoinGameBtn.hint_tooltip = "Cannot join another server, Server already started."
|
||||
#Goto a lobby instance
|
||||
|
||||
func join_game():
|
||||
var host = NetworkedMultiplayerENet.new()
|
||||
host.create_client(ip, port)
|
||||
get_tree().set_network_peer(host)
|
||||
print("Maybe it joined...?")
|
378
scenes/menu.tscn
Normal file
378
scenes/menu.tscn
Normal file
|
@ -0,0 +1,378 @@
|
|||
[gd_scene load_steps=11 format=2]
|
||||
|
||||
[ext_resource path="res://misc/fonts/font_buttons.tres" type="DynamicFont" id=1]
|
||||
[ext_resource path="res://misc/fonts/field_labels.tres" type="DynamicFont" id=2]
|
||||
[ext_resource path="res://misc/fonts/fieldfonts.tres" type="DynamicFont" id=3]
|
||||
[ext_resource path="res://scenes/menu.gd" type="Script" id=4]
|
||||
[ext_resource path="res://Sounds/mus_test.ogg" type="AudioStream" id=5]
|
||||
[ext_resource path="res://Backgrounds/bkMountains.png" type="Texture" id=6]
|
||||
[ext_resource path="res://misc/panel_mainmenu.tres" type="StyleBox" id=7]
|
||||
[ext_resource path="res://Backgrounds/bk_clouds.png" type="Texture" id=8]
|
||||
[ext_resource path="res://Sprites/polo_sprites/poloright_0.png" type="Texture" id=9]
|
||||
|
||||
[sub_resource type="Theme" id=1]
|
||||
default_font = ExtResource( 3 )
|
||||
|
||||
[node name="Menu" type="Control"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
script = ExtResource( 4 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Header2" type="Label" parent="."]
|
||||
margin_right = 158.0
|
||||
margin_bottom = 11.0
|
||||
rect_scale = Vector2( 4, 4 )
|
||||
custom_fonts/font = ExtResource( 2 )
|
||||
text = "POLO"
|
||||
align = 1
|
||||
valign = 1
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="stars" type="Sprite" parent="."]
|
||||
show_behind_parent = true
|
||||
position = Vector2( 344, 376 )
|
||||
scale = Vector2( 1.5, 1.5 )
|
||||
texture = ExtResource( 8 )
|
||||
region_enabled = true
|
||||
region_rect = Rect2( 0, 0, 500, 500 )
|
||||
__meta__ = {
|
||||
"_edit_lock_": true,
|
||||
"_editor_description_": "50"
|
||||
}
|
||||
|
||||
[node name="mountains" type="Sprite" parent="."]
|
||||
show_behind_parent = true
|
||||
position = Vector2( 304, 480 )
|
||||
scale = Vector2( 1.5, 1.5 )
|
||||
texture = ExtResource( 6 )
|
||||
region_enabled = true
|
||||
region_rect = Rect2( 0, 0, 500, 500 )
|
||||
__meta__ = {
|
||||
"_edit_lock_": true
|
||||
}
|
||||
|
||||
[node name="music" type="AudioStreamPlayer" parent="."]
|
||||
stream = ExtResource( 5 )
|
||||
autoplay = true
|
||||
|
||||
[node name="Header3" type="Label" parent="."]
|
||||
margin_left = 304.0
|
||||
margin_top = 32.0
|
||||
margin_right = 400.0
|
||||
margin_bottom = 54.0
|
||||
rect_scale = Vector2( 0.75, 0.75 )
|
||||
custom_fonts/font = ExtResource( 2 )
|
||||
text = "godot edition"
|
||||
align = 1
|
||||
valign = 1
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="GeneralPanel" type="Panel" parent="."]
|
||||
anchor_left = 0.0125
|
||||
anchor_top = 0.0888889
|
||||
anchor_right = 0.0125
|
||||
anchor_bottom = 0.0888889
|
||||
margin_left = 8.0
|
||||
margin_top = 40.0
|
||||
margin_right = 616.0
|
||||
margin_bottom = 139.0
|
||||
custom_styles/panel = ExtResource( 7 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Label" type="Label" parent="GeneralPanel"]
|
||||
margin_left = 8.0
|
||||
margin_right = 600.0
|
||||
margin_bottom = 22.0
|
||||
custom_fonts/font = ExtResource( 2 )
|
||||
text = "General"
|
||||
align = 1
|
||||
valign = 1
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="label_port" type="Label" parent="GeneralPanel"]
|
||||
margin_left = 8.0
|
||||
margin_top = 24.0
|
||||
margin_right = 64.0
|
||||
margin_bottom = 46.0
|
||||
custom_fonts/font = ExtResource( 2 )
|
||||
text = "Name:"
|
||||
align = 2
|
||||
valign = 1
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="player_name" type="LineEdit" parent="GeneralPanel"]
|
||||
margin_left = 72.0
|
||||
margin_top = 24.0
|
||||
margin_right = 303.0
|
||||
margin_bottom = 48.0
|
||||
custom_fonts/font = ExtResource( 3 )
|
||||
text = "Rico"
|
||||
max_length = 32
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="singleplayer" type="Button" parent="GeneralPanel"]
|
||||
anchor_left = 0.5
|
||||
anchor_top = 1.0
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 1.0
|
||||
margin_left = 176.0
|
||||
margin_top = -35.0
|
||||
margin_right = 280.0
|
||||
margin_bottom = -14.0
|
||||
hint_tooltip = "Start a singleplayer game"
|
||||
mouse_default_cursor_shape = 2
|
||||
custom_fonts/font = ExtResource( 1 )
|
||||
text = "Single player"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="HostPanel" type="Panel" parent="."]
|
||||
anchor_left = 0.0125
|
||||
anchor_top = 0.0888889
|
||||
anchor_right = 0.0125
|
||||
anchor_bottom = 0.0888889
|
||||
margin_left = 8.0
|
||||
margin_top = 144.0
|
||||
margin_right = 280.0
|
||||
margin_bottom = 318.0
|
||||
custom_styles/panel = ExtResource( 7 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Host_Header" type="Label" parent="HostPanel"]
|
||||
anchor_left = 6.60554e-08
|
||||
anchor_right = 6.60554e-08
|
||||
margin_left = -1.909e-05
|
||||
margin_right = 137.0
|
||||
margin_bottom = 16.0
|
||||
rect_scale = Vector2( 2, 2 )
|
||||
custom_fonts/font = ExtResource( 2 )
|
||||
text = "Host"
|
||||
align = 1
|
||||
valign = 1
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="label_port" type="Label" parent="HostPanel"]
|
||||
margin_left = 8.0
|
||||
margin_top = 50.0
|
||||
margin_right = 72.0
|
||||
margin_bottom = 72.0
|
||||
custom_fonts/font = ExtResource( 2 )
|
||||
text = "PORT:"
|
||||
align = 2
|
||||
valign = 1
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="label_myip" type="Label" parent="HostPanel"]
|
||||
margin_left = -8.0
|
||||
margin_top = 24.0
|
||||
margin_right = 272.0
|
||||
margin_bottom = 46.0
|
||||
custom_fonts/font = ExtResource( 2 )
|
||||
text = "IP: 0"
|
||||
align = 1
|
||||
valign = 1
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="label_players" type="Label" parent="HostPanel"]
|
||||
margin_left = 13.0
|
||||
margin_top = 83.0
|
||||
margin_right = 72.0
|
||||
margin_bottom = 105.0
|
||||
custom_fonts/font = ExtResource( 2 )
|
||||
text = "Players:"
|
||||
align = 2
|
||||
valign = 1
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="host_port" type="LineEdit" parent="HostPanel"]
|
||||
margin_left = 88.0
|
||||
margin_top = 48.0
|
||||
margin_right = 182.0
|
||||
margin_bottom = 72.0
|
||||
custom_fonts/font = ExtResource( 3 )
|
||||
text = "2670"
|
||||
max_length = 5
|
||||
editable = false
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="ToolButton" type="ToolButton" parent="HostPanel/host_port"]
|
||||
margin_left = 96.0
|
||||
margin_right = 143.0
|
||||
margin_bottom = 25.0
|
||||
custom_fonts/font = ExtResource( 2 )
|
||||
disabled = true
|
||||
text = "Reset"
|
||||
|
||||
[node name="playercount" type="SpinBox" parent="HostPanel"]
|
||||
margin_left = 88.0
|
||||
margin_top = 80.0
|
||||
margin_right = 198.0
|
||||
margin_bottom = 104.0
|
||||
theme = SubResource( 1 )
|
||||
min_value = 2.0
|
||||
max_value = 4.0
|
||||
value = 2.0
|
||||
rounded = true
|
||||
suffix = "players"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="CheckBox" type="CheckBox" parent="HostPanel"]
|
||||
margin_left = 88.0
|
||||
margin_top = 104.0
|
||||
margin_right = 264.0
|
||||
margin_bottom = 128.0
|
||||
hint_tooltip = "Tonytins mode! Duh!"
|
||||
custom_fonts/font = ExtResource( 3 )
|
||||
disabled = true
|
||||
toggle_mode = false
|
||||
shortcut_in_tooltip = false
|
||||
text = "Tonytins Mode"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="HostGameBtn" type="Button" parent="HostPanel"]
|
||||
anchor_left = 0.5
|
||||
anchor_top = 1.0
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 1.0
|
||||
margin_left = -56.0
|
||||
margin_top = -38.0
|
||||
margin_right = 56.0
|
||||
margin_bottom = -17.0
|
||||
hint_tooltip = "Host a online game with above parameters"
|
||||
mouse_default_cursor_shape = 2
|
||||
custom_fonts/font = ExtResource( 1 )
|
||||
text = "Host Server"
|
||||
icon = ExtResource( 9 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="JoinPanel" type="Panel" parent="."]
|
||||
anchor_left = 0.0125
|
||||
anchor_top = 0.0888889
|
||||
anchor_right = 0.0125
|
||||
anchor_bottom = 0.0888889
|
||||
margin_left = 296.0
|
||||
margin_top = 144.0
|
||||
margin_right = 616.0
|
||||
margin_bottom = 318.0
|
||||
custom_styles/panel = ExtResource( 7 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Join_Header" type="Label" parent="JoinPanel"]
|
||||
margin_right = 160.0
|
||||
margin_bottom = 16.0
|
||||
rect_scale = Vector2( 2, 2 )
|
||||
custom_fonts/font = ExtResource( 2 )
|
||||
text = "Join"
|
||||
align = 1
|
||||
valign = 1
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="label_ip" type="Label" parent="JoinPanel"]
|
||||
margin_left = 8.0
|
||||
margin_top = 48.0
|
||||
margin_right = 64.0
|
||||
margin_bottom = 70.0
|
||||
custom_fonts/font = ExtResource( 2 )
|
||||
text = "IP:"
|
||||
align = 2
|
||||
valign = 1
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="join_ip" type="LineEdit" parent="JoinPanel"]
|
||||
margin_left = 80.0
|
||||
margin_top = 48.0
|
||||
margin_right = 208.0
|
||||
margin_bottom = 72.0
|
||||
custom_fonts/font = ExtResource( 3 )
|
||||
text = "24.118.230.18"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="label_portjoin" type="Label" parent="JoinPanel"]
|
||||
margin_left = 8.0
|
||||
margin_top = 80.0
|
||||
margin_right = 64.0
|
||||
margin_bottom = 102.0
|
||||
custom_fonts/font = ExtResource( 2 )
|
||||
text = "PORT:"
|
||||
align = 2
|
||||
valign = 1
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="join_port" type="LineEdit" parent="JoinPanel"]
|
||||
margin_left = 80.0
|
||||
margin_top = 80.0
|
||||
margin_right = 208.0
|
||||
margin_bottom = 104.0
|
||||
custom_fonts/font = ExtResource( 3 )
|
||||
text = "2500"
|
||||
max_length = 5
|
||||
editable = false
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="JoinGameBtn" type="Button" parent="JoinPanel"]
|
||||
anchor_left = 0.5
|
||||
anchor_top = 1.0
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 1.0
|
||||
margin_left = -53.0
|
||||
margin_top = -38.0
|
||||
margin_right = 52.0
|
||||
margin_bottom = -17.0
|
||||
hint_tooltip = "Join an online game with above parameters"
|
||||
mouse_default_cursor_shape = 2
|
||||
custom_fonts/font = ExtResource( 1 )
|
||||
text = "Join Server"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Node" type="Node" parent="."]
|
||||
[connection signal="button_up" from="GeneralPanel/singleplayer" to="." method="_on_singleplayer_button_up"]
|
||||
[connection signal="button_up" from="HostPanel/HostGameBtn" to="." method="_on_HostGameBtn_button_up"]
|
||||
[connection signal="button_up" from="JoinPanel/JoinGameBtn" to="." method="_on_JoinGameBtn_button_up"]
|
Loading…
Add table
Add a link
Reference in a new issue