Added something

This commit is contained in:
Kristofers Solo 2021-11-18 20:04:41 +02:00
parent fc26a2d903
commit d542c495e2
12 changed files with 165 additions and 47 deletions

View File

@ -414,6 +414,7 @@ sync func hit_by_damager(damage):
health_bar_instance.value = hp
hit_timer.start()
sync func enable() -> void:
hp = 100
health_bar_instance.value = 100
@ -422,39 +423,17 @@ sync func enable() -> void:
$player_animated_sprite.show()
dead_player.hide()
$"weaponHolder/Player-character-theme-gun".show()
# $player_animated_sprite.show()
# $"Player-character-theme-gun".show()
# username_text_instance.visible = true
# health_bar_instance.visible = true
# visible = true
# $player_collider.disabled = false
# $hitbox/CollisionShape2D.disabled = false
# $weaponHolder.disabled = false
if get_tree().has_network_peer():
if is_network_master():
Global.player_master = self
if not Global.alive_players.has(self):
Global.alive_players.append(self)
# direction = "left"
# weaponPositionalOffset = Vector2(-$"weaponHolder/Player-character-theme-gun-na3".texture.get_width() * $"weaponHolder/Player-character-theme-gun-na3".scale.x / 2,-$"weaponHolder/Player-character-theme-gun-na3".texture.get_height() * $"weaponHolder/Player-character-theme-gun-na3".scale.y / 2) + Vector2(-$weaponHolder.get_shape().get_radius(), 0)
# $"weaponHolder/Player-character-theme-gun".position = weaponPositionalOffset
sync func destroy() -> void:
$player_animated_sprite.hide()
dead_player.show()
$"weaponHolder/Player-character-theme-gun".hide()
# $player_animated_sprite.hide()
# $"Player-character-theme-gun".hide()
# username_text_instance.visible = false
# health_bar_instance.visible = false
# visible = false
# $player_collider.disabled = true
# $hitbox/CollisionShape2D.disabled = true
# $weaponHolder.disabled = true
Global.alive_players.erase(self)
if get_tree().has_network_peer():
if is_network_master():

View File

@ -84,3 +84,7 @@ func instance_node(node: Object, parent: Object) -> Object:
var node_instance = node.instance()
parent.add_child(node_instance)
return node_instance
func _process(delta):
print(alive_players)

View File

@ -6,6 +6,8 @@ var current_player_location_instance_number = null
var globalActivePhase = null
func _ready() -> void:
$controls/user_input/controls/ready_button.hide()
$controls/user_input/controls/skip_button.hide()
# warning-ignore:return_value_discarded
get_tree().connect("network_peer_disconnected", self, "_player_disconnected")
if get_tree().is_network_server():

View File

@ -0,0 +1,16 @@
extends CanvasLayer
onready var lose_screen = $lose_screen
var green = Color("61d6a8")
var red = Color("dd6673")
func _ready() -> void:
lose_screen.hide()
func _process(_delta: float) -> void:
# print(Global.alive_players.size())
if Global.alive_players.size() <= 0 and get_tree().has_network_peer():
if Global.alive_players[0].name == str(get_tree().get_network_unique_id()):
lose_screen.show()

View File

@ -0,0 +1,9 @@
extends Node2D
func _on_respawn_pressed():
pass # Replace with function body.
func _on_exit_pressed():
get_tree().change_scene("res://source/scenes/GUI/main_menu.tscn")

View File

@ -376,7 +376,7 @@ wait_time = 0.03
autostart = true
[node name="reload_timer" type="Timer" parent="."]
wait_time = 0.15
wait_time = 0.7
one_shot = true
[node name="hit_timer" type="Timer" parent="."]

View File

@ -1,9 +1,11 @@
[gd_scene load_steps=15 format=2]
[gd_scene load_steps=17 format=2]
[ext_resource path="res://source/assets/scripts/server_handlers/trinity_site_level_playground.gd" type="Script" id=1]
[ext_resource path="res://source/assets/scripts/ui_element_handlers/UI.gd" type="Script" id=2]
[ext_resource path="res://source/levels/trinity_site/images/trinity_site_level_layout_level_design_z_index_0.svg" type="Texture" id=3]
[ext_resource path="res://source/entities/ts_bot/ts_bot.tscn" type="PackedScene" id=4]
[ext_resource path="res://source/scenes/OVERLAY/elements/lose_screen.tscn" type="PackedScene" id=5]
[ext_resource path="res://source/assets/scripts/ui_element_handlers/game_UI_playground.gd" type="Script" id=6]
[ext_resource path="res://source/levels/trinity_site/images/trinity_site_level_layout_level_design_z_index_4.svg" type="Texture" id=7]
[ext_resource path="res://source/levels/trinity_site/images/trinity_site_level_layout_level_design_z_index_3.svg" type="Texture" id=8]
[ext_resource path="res://source/entities/grass/grass_node.tscn" type="PackedScene" id=9]
@ -168,6 +170,7 @@ margin_top = -150.0
margin_bottom = 0.0
[node name="timer" parent="controls" instance=ExtResource( 17 )]
visible = false
anchor_left = 0.5
anchor_right = 0.5
margin_left = -225.0
@ -178,3 +181,8 @@ position = Vector2( 383, 564 )
[node name="ts_bot2" parent="." instance=ExtResource( 4 )]
position = Vector2( 1538, 581 )
[node name="game_UI" type="CanvasLayer" parent="."]
script = ExtResource( 6 )
[node name="lose_screen" parent="game_UI" instance=ExtResource( 5 )]

View File

@ -22,8 +22,8 @@ margin_right = 170.0
margin_bottom = 76.0
rect_scale = Vector2( 0.35, 0.35 )
input_pass_on_modal_close_click = false
custom_colors/font_color = Color( 0.364706, 0.952941, 0.423529, 1 )
custom_fonts/font = ExtResource( 1 )
custom_colors/font_color = Color( 0.364706, 0.952941, 0.423529, 1 )
text = "MOVE HERE"
align = 1
valign = 1

View File

@ -114,6 +114,7 @@ margin_top = -150.0
margin_bottom = 0.0
[node name="timer" parent="controls" instance=ExtResource( 17 )]
visible = false
anchor_left = 0.5
anchor_right = 0.5
margin_left = -225.0

View File

@ -12,16 +12,16 @@ use_mipmaps = true
use_filter = true
font_data = ExtResource( 2 )
[sub_resource type="StyleBoxEmpty" id=2]
[sub_resource type="StyleBoxEmpty" id=3]
[sub_resource type="DynamicFont" id=4]
size = 36
use_mipmaps = true
use_filter = true
font_data = ExtResource( 2 )
[sub_resource type="StyleBoxEmpty" id=2]
[sub_resource type="StyleBoxEmpty" id=3]
[sub_resource type="DynamicFont" id=5]
size = 36
use_mipmaps = true
@ -64,8 +64,8 @@ margin_left = -225.0
margin_top = -25.0
margin_right = -225.0
margin_bottom = -25.0
custom_colors/font_color = Color( 0, 0, 0, 1 )
custom_fonts/font = SubResource( 1 )
custom_colors/font_color = Color( 0, 0, 0, 1 )
text = "Enter your username"
align = 1
valign = 1
@ -98,10 +98,10 @@ margin_left = -175.0
margin_top = -28.0
margin_right = 175.0
margin_bottom = 28.0
custom_colors/selection_color = Color( 0.8, 0.8, 0.8, 1 )
custom_fonts/font = SubResource( 4 )
custom_styles/focus = SubResource( 2 )
custom_styles/normal = SubResource( 3 )
custom_fonts/font = SubResource( 4 )
custom_colors/selection_color = Color( 0.8, 0.8, 0.8, 1 )
align = 1
placeholder_text = "username"
__meta__ = {
@ -123,8 +123,8 @@ margin_bottom = 97.0
[node name="Label" type="Label" parent="popup_screen/panel/confirm"]
anchor_right = 1.0
anchor_bottom = 1.0
custom_colors/font_color = Color( 0, 0, 0, 1 )
custom_fonts/font = SubResource( 5 )
custom_colors/font_color = Color( 0, 0, 0, 1 )
text = "CONFIRM"
align = 1
valign = 1

View File

@ -21,16 +21,16 @@ use_mipmaps = true
use_filter = true
font_data = ExtResource( 2 )
[sub_resource type="StyleBoxEmpty" id=2]
[sub_resource type="StyleBoxEmpty" id=3]
[sub_resource type="DynamicFont" id=4]
size = 36
use_mipmaps = true
use_filter = true
font_data = ExtResource( 2 )
[sub_resource type="StyleBoxEmpty" id=2]
[sub_resource type="StyleBoxEmpty" id=3]
[sub_resource type="DynamicFont" id=5]
size = 36
use_mipmaps = true
@ -94,8 +94,8 @@ margin_left = -150.0
margin_top = -36.0
margin_right = 150.0
margin_bottom = 36.0
custom_colors/font_color = Color( 0, 0, 0, 1 )
custom_fonts/font = ExtResource( 8 )
custom_colors/font_color = Color( 0, 0, 0, 1 )
text = "CREATE SERVER"
align = 1
valign = 1
@ -118,8 +118,8 @@ anchor_bottom = 0.5
margin_left = -233.0
margin_top = -36.0
margin_bottom = 36.0
custom_colors/font_color = Color( 0, 0, 0, 1 )
custom_fonts/font = ExtResource( 8 )
custom_colors/font_color = Color( 0, 0, 0, 1 )
text = "JOIN SERVER"
align = 1
valign = 1
@ -154,8 +154,8 @@ margin_left = -150.0
margin_top = -36.0
margin_right = 150.0
margin_bottom = 36.0
custom_colors/font_color = Color( 0, 0, 0, 1 )
custom_fonts/font = ExtResource( 8 )
custom_colors/font_color = Color( 0, 0, 0, 1 )
text = "RETURN"
align = 1
valign = 1
@ -186,8 +186,8 @@ margin_left = -225.0
margin_top = -25.0
margin_right = -225.0
margin_bottom = -25.0
custom_colors/font_color = Color( 0, 0, 0, 1 )
custom_fonts/font = SubResource( 1 )
custom_colors/font_color = Color( 0, 0, 0, 1 )
text = "Enter your username"
align = 1
valign = 1
@ -218,10 +218,10 @@ margin_left = -175.0
margin_top = -28.0
margin_right = 175.0
margin_bottom = 28.0
custom_colors/selection_color = Color( 0.8, 0.8, 0.8, 1 )
custom_fonts/font = SubResource( 4 )
custom_styles/focus = SubResource( 2 )
custom_styles/normal = SubResource( 3 )
custom_fonts/font = SubResource( 4 )
custom_colors/selection_color = Color( 0.8, 0.8, 0.8, 1 )
align = 1
placeholder_text = "username"
__meta__ = {
@ -242,8 +242,8 @@ margin_bottom = 97.0
[node name="Label" type="Label" parent="multiplayer_configure/popup_screen/panel/confirm"]
anchor_right = 1.0
anchor_bottom = 1.0
custom_colors/font_color = Color( 0, 0, 0, 1 )
custom_fonts/font = SubResource( 5 )
custom_colors/font_color = Color( 0, 0, 0, 1 )
text = "CONFIRM"
align = 1
valign = 1
@ -304,8 +304,8 @@ margin_left = -74.5
margin_top = -32.0
margin_right = 74.5
margin_bottom = 32.0
custom_colors/font_color = Color( 0, 0, 0, 1 )
custom_fonts/font = ExtResource( 10 )
custom_colors/font_color = Color( 0, 0, 0, 1 )
text = "START"
align = 1
valign = 1
@ -324,8 +324,8 @@ margin_left = 621.0
margin_top = 464.0
margin_right = 1259.0
margin_bottom = 576.0
custom_colors/font_color = Color( 0.439216, 0.666667, 1, 0.27451 )
custom_fonts/font = SubResource( 6 )
custom_colors/font_color = Color( 0.439216, 0.666667, 1, 0.27451 )
align = 1
valign = 1
__meta__ = {
@ -343,8 +343,8 @@ margin_left = 823.5
margin_top = 580.0
margin_right = 1056.5
margin_bottom = 609.0
custom_colors/font_color = Color( 0.439216, 0.666667, 1, 0.27451 )
custom_fonts/font = SubResource( 7 )
custom_colors/font_color = Color( 0.439216, 0.666667, 1, 0.27451 )
text = "WAITING FOR PLAYERS"
align = 1
valign = 1

View File

@ -0,0 +1,99 @@
[gd_scene load_steps=9 format=2]
[ext_resource path="res://source/fonts/oxygen/Oxygen-Bold.ttf" type="DynamicFontData" id=1]
[ext_resource path="res://source/fonts/oxygen/Oxygen-Regular.ttf" type="DynamicFontData" id=2]
[ext_resource path="res://source/fonts/oxygen/oxygen_regular.tres" type="DynamicFont" id=3]
[ext_resource path="res://source/scenes/OVERLAY/elements/button.tscn" type="PackedScene" id=4]
[ext_resource path="res://source/assets/scripts/ui_element_handlers/lose_screen.gd" type="Script" id=5]
[sub_resource type="StyleBoxFlat" id=1]
bg_color = Color( 0, 0, 0, 0.588235 )
[sub_resource type="DynamicFont" id=2]
size = 144
use_mipmaps = true
use_filter = true
font_data = ExtResource( 1 )
[sub_resource type="DynamicFont" id=3]
size = 50
use_mipmaps = true
use_filter = true
font_data = ExtResource( 2 )
[node name="lose_screen" type="Node2D"]
script = ExtResource( 5 )
[node name="Panel" type="Panel" parent="."]
margin_right = 1920.0
margin_bottom = 1080.0
rect_scale = Vector2( 1.00112, 1 )
custom_styles/panel = SubResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Label" type="Label" parent="Panel"]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -492.5
margin_top = -91.0
margin_right = 492.5
margin_bottom = 91.0
custom_fonts/font = SubResource( 2 )
custom_colors/font_color = Color( 0.858824, 0.396078, 0.447059, 1 )
text = "you died!"
align = 1
valign = 1
uppercase = true
__meta__ = {
"_edit_use_anchors_": false
}
[node name="respawn" parent="Panel" instance=ExtResource( 4 )]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -350.0
margin_top = 110.0
margin_right = -49.9995
margin_bottom = 182.0
[node name="Label" type="Label" parent="Panel/respawn"]
anchor_right = 1.0
anchor_bottom = 1.0
custom_fonts/font = ExtResource( 3 )
custom_colors/font_color = Color( 0, 0, 0, 1 )
text = "respawn"
align = 1
valign = 1
uppercase = true
__meta__ = {
"_edit_use_anchors_": false
}
[node name="exit" parent="Panel" instance=ExtResource( 4 )]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = 50.0
margin_top = 110.0
margin_right = 350.0
margin_bottom = 182.0
[node name="Label" type="Label" parent="Panel/exit"]
anchor_right = 1.0
anchor_bottom = 1.0
custom_fonts/font = SubResource( 3 )
custom_colors/font_color = Color( 0, 0, 0, 1 )
text = "exit"
align = 1
valign = 1
uppercase = true
[connection signal="pressed" from="Panel/respawn" to="." method="_on_respawn_pressed"]
[connection signal="pressed" from="Panel/exit" to="." method="_on_exit_pressed"]