forked from unfa/liblast
Merge branch 'master' of github.com:unfa/jam-01 into master
This commit is contained in:
commit
d30a52102d
16 changed files with 401 additions and 96 deletions
|
@ -1,8 +1,6 @@
|
|||
[gd_scene load_steps=11 format=2]
|
||||
[gd_scene load_steps=9 format=2]
|
||||
|
||||
[ext_resource path="res://Assets/HUD/HealthBarOver.svg" type="Texture" id=1]
|
||||
[ext_resource path="res://Assets/HUD/HealthBarProgress.svg" type="Texture" id=2]
|
||||
[ext_resource path="res://Assets/HUD/HealthBarUnder.svg" type="Texture" id=3]
|
||||
[ext_resource path="res://Health.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://Assets/HUD/Panel.svg" type="Texture" id=4]
|
||||
[ext_resource path="res://GUI/HitConfirmation.gd" type="Script" id=5]
|
||||
[ext_resource path="res://Assets/SFX/UI-HitConfirmation.wav" type="AudioStream" id=6]
|
||||
|
@ -57,54 +55,7 @@ __meta__ = {
|
|||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Health" type="MarginContainer" parent="."]
|
||||
anchor_top = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_left = 32.0
|
||||
margin_top = -50.0
|
||||
margin_right = 148.0
|
||||
margin_bottom = -32.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="HealthBar" type="TextureProgress" parent="Health"]
|
||||
margin_right = 150.0
|
||||
margin_bottom = 50.0
|
||||
rect_min_size = Vector2( 150, 50 )
|
||||
max_value = 150.0
|
||||
value = 100.0
|
||||
texture_under = ExtResource( 3 )
|
||||
texture_over = ExtResource( 1 )
|
||||
texture_progress = ExtResource( 2 )
|
||||
tint_under = Color( 0, 0, 0, 0.0980392 )
|
||||
tint_progress = Color( 0, 1, 1.2, 0.75 )
|
||||
nine_patch_stretch = true
|
||||
stretch_margin_left = 25
|
||||
stretch_margin_top = 25
|
||||
stretch_margin_right = 25
|
||||
stretch_margin_bottom = 25
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="HealthText" type="Label" parent="Health/HealthBar"]
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
margin_left = -80.0
|
||||
margin_top = -24.5
|
||||
margin_right = 80.0
|
||||
margin_bottom = 24.5
|
||||
text = "150"
|
||||
align = 1
|
||||
valign = 1
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
[node name="Health" parent="." instance=ExtResource( 1 )]
|
||||
|
||||
[node name="Weapon" type="MarginContainer" parent="."]
|
||||
anchor_left = 1.0
|
||||
|
|
19
Billboard.gd
Normal file
19
Billboard.gd
Normal file
|
@ -0,0 +1,19 @@
|
|||
extends MeshInstance
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
var texture = $Viewport.get_texture()
|
||||
var material = SpatialMaterial.new()
|
||||
|
||||
material.params_billboard_mode = SpatialMaterial.BILLBOARD_ENABLED
|
||||
material.flags_transparent = true
|
||||
material.flags_unshaded = true
|
||||
material.albedo_texture = texture
|
||||
|
||||
set_surface_material(0, material)
|
||||
|
||||
func set_nickname(name):
|
||||
$Viewport/VBoxContainer/Nametag.text = name
|
||||
|
||||
sync func set_health(health):
|
||||
$Viewport/VBoxContainer/Health/HealthBar.value=health
|
202
Fonts/Roboto_Condensed/LICENSE.txt
Normal file
202
Fonts/Roboto_Condensed/LICENSE.txt
Normal file
|
@ -0,0 +1,202 @@
|
|||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
BIN
Fonts/Roboto_Condensed/RobotoCondensed-Bold.ttf
Normal file
BIN
Fonts/Roboto_Condensed/RobotoCondensed-Bold.ttf
Normal file
Binary file not shown.
BIN
Fonts/Roboto_Condensed/RobotoCondensed-BoldItalic.ttf
Normal file
BIN
Fonts/Roboto_Condensed/RobotoCondensed-BoldItalic.ttf
Normal file
Binary file not shown.
BIN
Fonts/Roboto_Condensed/RobotoCondensed-Italic.ttf
Normal file
BIN
Fonts/Roboto_Condensed/RobotoCondensed-Italic.ttf
Normal file
Binary file not shown.
BIN
Fonts/Roboto_Condensed/RobotoCondensed-Light.ttf
Normal file
BIN
Fonts/Roboto_Condensed/RobotoCondensed-Light.ttf
Normal file
Binary file not shown.
BIN
Fonts/Roboto_Condensed/RobotoCondensed-LightItalic.ttf
Normal file
BIN
Fonts/Roboto_Condensed/RobotoCondensed-LightItalic.ttf
Normal file
Binary file not shown.
|
@ -0,0 +1,7 @@
|
|||
[gd_resource type="DynamicFont" load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://Fonts/Roboto_Condensed/RobotoCondensed-Regular.tres" type="DynamicFontData" id=1]
|
||||
|
||||
[resource]
|
||||
size = 48
|
||||
font_data = ExtResource( 1 )
|
4
Fonts/Roboto_Condensed/RobotoCondensed-Regular.tres
Normal file
4
Fonts/Roboto_Condensed/RobotoCondensed-Regular.tres
Normal file
|
@ -0,0 +1,4 @@
|
|||
[gd_resource type="DynamicFontData" format=2]
|
||||
|
||||
[resource]
|
||||
font_path = "res://Fonts/Roboto_Condensed/RobotoCondensed-Regular.ttf"
|
BIN
Fonts/Roboto_Condensed/RobotoCondensed-Regular.ttf
Normal file
BIN
Fonts/Roboto_Condensed/RobotoCondensed-Regular.ttf
Normal file
Binary file not shown.
42
Game.gd
42
Game.gd
|
@ -16,7 +16,8 @@ var settingmap = {
|
|||
}
|
||||
|
||||
onready var peer = NetworkedMultiplayerENet.new()
|
||||
var local_player = null
|
||||
var local_player = null setget set_local_player
|
||||
var player_name = "guest"
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
|
@ -28,6 +29,11 @@ func _ready():
|
|||
if auto_host:
|
||||
initialize_server(false)
|
||||
|
||||
func set_local_player(player):
|
||||
local_player = player
|
||||
player.set_local_player()
|
||||
player.rpc("set_nickname", $MenuContainer/MainMenu/Name.text)
|
||||
|
||||
func load_settings():
|
||||
var load_settings = File.new()
|
||||
load_settings.open("user://settings.save", File.READ)
|
||||
|
@ -101,6 +107,9 @@ func join_test_server():
|
|||
SERVER_IP = "unfa.xyz"
|
||||
initialize_client()
|
||||
|
||||
sync func set_player_name(player, name):
|
||||
print(name)
|
||||
|
||||
func join_home():
|
||||
SERVER_IP = "127.0.0.1"
|
||||
initialize_client()
|
||||
|
@ -158,6 +167,8 @@ func initialize_server(join=true):
|
|||
$MenuContainer/MainMenu/Disconnect.show()
|
||||
close_menus()
|
||||
|
||||
print(get_tree().get_network_unique_id())
|
||||
|
||||
if join:
|
||||
add_player(1, false)
|
||||
|
||||
|
@ -186,26 +197,33 @@ func free_client():
|
|||
func quit():
|
||||
get_tree().quit()
|
||||
|
||||
func get_player_names():
|
||||
func get_player_data():
|
||||
var players = $Players.get_children()
|
||||
|
||||
var player_names = []
|
||||
var player_data = {}
|
||||
for player in players:
|
||||
player_names.append(player.name)
|
||||
var data = {}
|
||||
data["nickname"] = player.nickname
|
||||
|
||||
player_data[player.name] = data
|
||||
|
||||
return player_names
|
||||
return player_data
|
||||
|
||||
sync func check_players(player_names):
|
||||
for player_name in player_names:
|
||||
sync func check_players(player_data):
|
||||
for player_name in player_data:
|
||||
if not $Players.has_node(player_name):
|
||||
var player = player_scene.instance()
|
||||
|
||||
player.name = player_name
|
||||
|
||||
$Players.add_child(player)
|
||||
player.translation += Vector3(0.0, 3.0, 0.0)
|
||||
|
||||
var data = player_data[player_name]
|
||||
player.set_nickname(data["nickname"])
|
||||
|
||||
if player_name == str(get_tree().get_network_unique_id()):
|
||||
player.set_local_player()
|
||||
set_local_player(player)
|
||||
|
||||
func add_player(id, check=true):
|
||||
var player = player_scene.instance()
|
||||
|
@ -215,12 +233,12 @@ func add_player(id, check=true):
|
|||
player.set_network_master(id)
|
||||
player.translation += Vector3(0.0, 0.0, 0.0)
|
||||
|
||||
var player_names = get_player_names()
|
||||
|
||||
if check:
|
||||
rpc("check_players", player_names)
|
||||
var player_data = get_player_data()
|
||||
rpc("check_players", player_data)
|
||||
else:
|
||||
local_player = player
|
||||
set_local_player(player)
|
||||
|
||||
|
||||
sync func remove_player(id):
|
||||
for player in $Players.get_children():
|
||||
|
|
38
Game.tscn
38
Game.tscn
|
@ -56,21 +56,27 @@ __meta__ = {
|
|||
|
||||
[node name="MainMenu" type="VBoxContainer" parent="MenuContainer"]
|
||||
margin_left = 312.0
|
||||
margin_top = 244.0
|
||||
margin_top = 230.0
|
||||
margin_right = 712.0
|
||||
margin_bottom = 356.0
|
||||
margin_bottom = 370.0
|
||||
rect_min_size = Vector2( 400, 0 )
|
||||
|
||||
[node name="QuickConnect" type="Button" parent="MenuContainer/MainMenu"]
|
||||
[node name="Name" type="LineEdit" parent="MenuContainer/MainMenu"]
|
||||
margin_right = 400.0
|
||||
margin_bottom = 40.0
|
||||
margin_bottom = 24.0
|
||||
placeholder_text = "Enter your name"
|
||||
|
||||
[node name="QuickConnect" type="Button" parent="MenuContainer/MainMenu"]
|
||||
margin_top = 28.0
|
||||
margin_right = 400.0
|
||||
margin_bottom = 68.0
|
||||
rect_min_size = Vector2( 0, 40 )
|
||||
text = "Quick Connect!"
|
||||
|
||||
[node name="Connect" type="Button" parent="MenuContainer/MainMenu"]
|
||||
margin_top = 44.0
|
||||
margin_top = 72.0
|
||||
margin_right = 400.0
|
||||
margin_bottom = 64.0
|
||||
margin_bottom = 92.0
|
||||
text = "Connect"
|
||||
|
||||
[node name="Disconnect" type="Button" parent="MenuContainer/MainMenu"]
|
||||
|
@ -81,23 +87,23 @@ margin_bottom = 44.0
|
|||
text = "Disconnect"
|
||||
|
||||
[node name="Options" type="Button" parent="MenuContainer/MainMenu"]
|
||||
margin_top = 68.0
|
||||
margin_top = 96.0
|
||||
margin_right = 400.0
|
||||
margin_bottom = 88.0
|
||||
margin_bottom = 116.0
|
||||
text = "Options"
|
||||
|
||||
[node name="Quit" type="Button" parent="MenuContainer/MainMenu"]
|
||||
margin_top = 92.0
|
||||
margin_top = 120.0
|
||||
margin_right = 400.0
|
||||
margin_bottom = 112.0
|
||||
margin_bottom = 140.0
|
||||
text = "Quit"
|
||||
|
||||
[node name="ConnectMenu" type="VBoxContainer" parent="MenuContainer"]
|
||||
visible = false
|
||||
margin_left = 312.0
|
||||
margin_top = 212.0
|
||||
margin_top = 224.0
|
||||
margin_right = 712.0
|
||||
margin_bottom = 388.0
|
||||
margin_bottom = 376.0
|
||||
rect_min_size = Vector2( 400, 0 )
|
||||
|
||||
[node name="Back" type="Button" parent="MenuContainer/ConnectMenu"]
|
||||
|
@ -157,12 +163,6 @@ text = "Join"
|
|||
margin_right = 40.0
|
||||
margin_bottom = 4.0
|
||||
|
||||
[node name="Test Server" type="Button" parent="MenuContainer/ConnectMenu"]
|
||||
margin_top = 76.0
|
||||
margin_right = 400.0
|
||||
margin_bottom = 96.0
|
||||
text = "Test Server"
|
||||
|
||||
[node name="Home" type="Button" parent="MenuContainer/ConnectMenu"]
|
||||
margin_top = 100.0
|
||||
margin_right = 400.0
|
||||
|
@ -263,7 +263,6 @@ margin_right = 300.0
|
|||
margin_bottom = 64.0
|
||||
text = "Fullscreen"
|
||||
[connection signal="pressed" from="MenuContainer/MainMenu/QuickConnect" to="." method="join_test_server"]
|
||||
[connection signal="pressed" from="MenuContainer/MainMenu/QuickConnect" to="." method="_on_QuickConnect_pressed"]
|
||||
[connection signal="pressed" from="MenuContainer/MainMenu/Connect" to="." method="open_menu" binds= [ "ConnectMenu" ]]
|
||||
[connection signal="pressed" from="MenuContainer/MainMenu/Disconnect" to="." method="free_client"]
|
||||
[connection signal="pressed" from="MenuContainer/MainMenu/Options" to="." method="open_menu" binds= [ "OptionsMenu" ]]
|
||||
|
@ -273,7 +272,6 @@ text = "Fullscreen"
|
|||
[connection signal="pressed" from="MenuContainer/ConnectMenu/NetworkType/Host" to="." method="initialize_server"]
|
||||
[connection signal="pressed" from="MenuContainer/ConnectMenu/NetworkType/HostAsSpectator" to="." method="initialize_server" binds= [ false ]]
|
||||
[connection signal="pressed" from="MenuContainer/ConnectMenu/NetworkType/Join" to="." method="initialize_client"]
|
||||
[connection signal="pressed" from="MenuContainer/ConnectMenu/Test Server" to="." method="join_test_server"]
|
||||
[connection signal="pressed" from="MenuContainer/ConnectMenu/Home" to="." method="join_home"]
|
||||
[connection signal="pressed" from="MenuContainer/ConnectMenu/Unfa" to="." method="join_unfa"]
|
||||
[connection signal="pressed" from="MenuContainer/ConnectMenu/Jan" to="." method="join_jan"]
|
||||
|
|
53
Health.tscn
Normal file
53
Health.tscn
Normal file
|
@ -0,0 +1,53 @@
|
|||
[gd_scene load_steps=4 format=2]
|
||||
|
||||
[ext_resource path="res://Assets/HUD/HealthBarOver.svg" type="Texture" id=1]
|
||||
[ext_resource path="res://Assets/HUD/HealthBarUnder.svg" type="Texture" id=2]
|
||||
[ext_resource path="res://Assets/HUD/HealthBarProgress.svg" type="Texture" id=3]
|
||||
|
||||
[node name="Health" type="MarginContainer"]
|
||||
anchor_top = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_left = 32.0
|
||||
margin_top = -50.0
|
||||
margin_right = 148.0
|
||||
margin_bottom = -32.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="HealthBar" type="TextureProgress" parent="."]
|
||||
margin_right = 150.0
|
||||
margin_bottom = 50.0
|
||||
rect_min_size = Vector2( 150, 50 )
|
||||
max_value = 150.0
|
||||
value = 150.0
|
||||
texture_under = ExtResource( 2 )
|
||||
texture_over = ExtResource( 1 )
|
||||
texture_progress = ExtResource( 3 )
|
||||
tint_under = Color( 0, 0, 0, 0.0980392 )
|
||||
tint_progress = Color( 0, 1, 1.2, 0.75 )
|
||||
nine_patch_stretch = true
|
||||
stretch_margin_left = 25
|
||||
stretch_margin_top = 25
|
||||
stretch_margin_right = 25
|
||||
stretch_margin_bottom = 25
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="HealthText" type="Label" parent="HealthBar"]
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
margin_left = -80.0
|
||||
margin_top = -24.5
|
||||
margin_right = 80.0
|
||||
margin_bottom = 24.5
|
||||
align = 1
|
||||
valign = 1
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
13
Player.gd
13
Player.gd
|
@ -37,6 +37,7 @@ var walkDirInt = Vector2.ZERO
|
|||
|
||||
#var bulletHitEffect = preload("res://Assets/Effects/BulletHit.tscn")
|
||||
var bodyHitEffect = preload("res://Assets/Effects/BodyHit.tscn")
|
||||
onready var nickname = "guest" setget set_nickname
|
||||
|
||||
#func sfx_play_footsteps():
|
||||
# if not sfx_footsteps_play:
|
||||
|
@ -51,8 +52,14 @@ var bodyHitEffect = preload("res://Assets/Effects/BodyHit.tscn")
|
|||
|
||||
func set_health(value):
|
||||
health = value
|
||||
print("Set health")
|
||||
$HUD.updateHealth(value)
|
||||
print(value)
|
||||
$Billboard.rpc("set_health", value)
|
||||
#$Billboard.set_health(value)
|
||||
|
||||
sync func set_nickname(_nickname):
|
||||
$Billboard.set_nickname(_nickname)
|
||||
nickname = _nickname
|
||||
|
||||
func gravity():
|
||||
if not is_on_floor():
|
||||
|
@ -149,7 +156,6 @@ func motion(delta):
|
|||
velocity -= get_floor_normal() * 150
|
||||
|
||||
func _physics_process(delta):
|
||||
|
||||
if is_dead:
|
||||
return
|
||||
|
||||
|
@ -312,10 +318,9 @@ func _input(event):
|
|||
|
||||
func set_local_player():
|
||||
set_network_master(get_tree().get_network_unique_id())
|
||||
game.local_player = self
|
||||
camera.current = true
|
||||
|
||||
$HUD.show()
|
||||
$Billboard.hide()
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
|
|
64
Player.tscn
64
Player.tscn
|
@ -1,19 +1,25 @@
|
|||
[gd_scene load_steps=8 format=2]
|
||||
[gd_scene load_steps=12 format=2]
|
||||
|
||||
[ext_resource path="res://Player.gd" type="Script" id=1]
|
||||
[ext_resource path="res://Assets/Weapons/Handgun/Handgun.tscn" type="PackedScene" id=2]
|
||||
[ext_resource path="res://Assets/HUD/HUD.tscn" type="PackedScene" id=3]
|
||||
[ext_resource path="res://Billboard.gd" type="Script" id=4]
|
||||
[ext_resource path="res://Fonts/Roboto_Condensed/RobotoCondensed-Regular-dynamic.tres" type="DynamicFont" id=5]
|
||||
[ext_resource path="res://Health.tscn" type="PackedScene" id=6]
|
||||
[ext_resource path="res://Audio/SoundPlayer.tscn" type="PackedScene" id=7]
|
||||
|
||||
[sub_resource type="CapsuleShape" id=1]
|
||||
[sub_resource type="QuadMesh" id=1]
|
||||
size = Vector2( 2, 0.6 )
|
||||
|
||||
[sub_resource type="CapsuleShape" id=3]
|
||||
radius = 0.33
|
||||
height = 1.1
|
||||
|
||||
[sub_resource type="CylinderShape" id=2]
|
||||
[sub_resource type="CylinderShape" id=4]
|
||||
radius = 0.2
|
||||
height = 0.3
|
||||
|
||||
[sub_resource type="CapsuleMesh" id=3]
|
||||
[sub_resource type="CapsuleMesh" id=5]
|
||||
radius = 0.33
|
||||
mid_height = 1.1
|
||||
|
||||
|
@ -28,21 +34,63 @@ transform = Transform( -4.37114e-08, 0, -1, 0, 1, 0, 1, 0, -4.37114e-08, 0.335,
|
|||
|
||||
[node name="Weapon" parent="Camera/Hand" instance=ExtResource( 2 )]
|
||||
|
||||
[node name="Billboard" type="MeshInstance" parent="."]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.03304, 0 )
|
||||
mesh = SubResource( 1 )
|
||||
material/0 = null
|
||||
script = ExtResource( 4 )
|
||||
|
||||
[node name="Viewport" type="Viewport" parent="Billboard"]
|
||||
size = Vector2( 500, 150 )
|
||||
transparent_bg = true
|
||||
handle_input_locally = false
|
||||
hdr = false
|
||||
usage = 0
|
||||
render_target_v_flip = true
|
||||
gui_disable_input = true
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="Billboard/Viewport"]
|
||||
margin_right = 500.0
|
||||
margin_bottom = 111.0
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Nametag" type="Label" parent="Billboard/Viewport/VBoxContainer"]
|
||||
margin_right = 500.0
|
||||
margin_bottom = 57.0
|
||||
rect_min_size = Vector2( 500, 50 )
|
||||
custom_fonts/font = ExtResource( 5 )
|
||||
text = "guest"
|
||||
align = 1
|
||||
valign = 1
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Health" parent="Billboard/Viewport/VBoxContainer" instance=ExtResource( 6 )]
|
||||
anchor_top = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_left = 0.0
|
||||
margin_top = 61.0
|
||||
margin_right = 500.0
|
||||
margin_bottom = 111.0
|
||||
|
||||
[node name="CollisionShapeBody" type="CollisionShape" parent="."]
|
||||
transform = Transform( 1, 0, 0, 0, -1.62921e-07, 1, 0, -1, -1.62921e-07, 0, 0.882822, 0 )
|
||||
shape = SubResource( 1 )
|
||||
shape = SubResource( 3 )
|
||||
|
||||
[node name="CollisionShapeFeet" type="CollisionShape" parent="."]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.150321, 0 )
|
||||
shape = SubResource( 2 )
|
||||
shape = SubResource( 4 )
|
||||
|
||||
[node name="MeshInstance" type="MeshInstance" parent="."]
|
||||
transform = Transform( 1, 0, 0, 0, -1.62921e-07, -1, 0, 1, -1.62921e-07, 0, 0.882822, 0 )
|
||||
mesh = SubResource( 3 )
|
||||
mesh = SubResource( 5 )
|
||||
material/0 = null
|
||||
|
||||
[node name="Debug" type="Label" parent="."]
|
||||
margin_right = 40.0
|
||||
margin_right = 41.0
|
||||
margin_bottom = 14.0
|
||||
custom_colors/font_color_shadow = Color( 0, 0, 0, 1 )
|
||||
text = "Debug"
|
||||
|
|
Loading…
Reference in a new issue