WIP: Add basic damage
This commit is contained in:
11
scenes/utils/in_game_hud.gd
Normal file
11
scenes/utils/in_game_hud.gd
Normal file
@ -0,0 +1,11 @@
|
||||
extends Control
|
||||
|
||||
@onready =
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
pass
|
55
scenes/utils/in_game_hud.tscn
Normal file
55
scenes/utils/in_game_hud.tscn
Normal file
@ -0,0 +1,55 @@
|
||||
[gd_scene load_steps=5 format=3 uid="uid://c137wl6ls3knx"]
|
||||
|
||||
[ext_resource type="Script" path="res://scenes/utils/in_game_hud.gd" id="1_sttf0"]
|
||||
[ext_resource type="Texture2D" uid="uid://oopj5mj1vdp0" path="res://assets/crosshairs/crosshair_default.png" id="2_fjr6q"]
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_ds4qb"]
|
||||
font_size = 70
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_vhjwu"]
|
||||
font_size = 100
|
||||
font_color = Color(0.756874, 0, 0.223924, 1)
|
||||
|
||||
[node name="InGameHud" type="Control"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_sttf0")
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -28.0
|
||||
offset_top = -36.0
|
||||
offset_right = 44.0
|
||||
offset_bottom = 36.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
texture = ExtResource("2_fjr6q")
|
||||
|
||||
[node name="HealthIndicator" type="Label" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 2
|
||||
anchor_top = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_left = 8.0
|
||||
offset_top = -96.0
|
||||
offset_right = 128.0
|
||||
grow_vertical = 0
|
||||
text = "100"
|
||||
label_settings = SubResource("LabelSettings_ds4qb")
|
||||
|
||||
[node name="FPS" type="Label" parent="." groups=["player_placeholder"]]
|
||||
layout_mode = 1
|
||||
offset_left = 8.0
|
||||
offset_right = 65.0
|
||||
offset_bottom = 137.0
|
||||
text = "0"
|
||||
label_settings = SubResource("LabelSettings_vhjwu")
|
@ -65,7 +65,7 @@ func player_loaded():
|
||||
# When a peer connects, send them my player info.
|
||||
# This allows transfer of all desired data for each player, not only the unique ID.
|
||||
func _on_player_connected(id):
|
||||
player_info = {"name": multiplayer.get_unique_id()}
|
||||
player_info = {"name": multiplayer.get_unique_id(), "health": 100}
|
||||
_register_player.rpc_id(1, multiplayer.get_unique_id(), player_info)
|
||||
|
||||
@rpc("any_peer", "reliable")
|
||||
@ -103,7 +103,7 @@ func _on_server_disconnected():
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
|
||||
func _on_host_pressed() -> void:
|
||||
player_info = {"name": str(1)}
|
||||
player_info = {"name": str(1), "health": 100}
|
||||
_register_player(1, player_info)
|
||||
create_game()
|
||||
|
||||
|
Reference in New Issue
Block a user