WIP: Spawn bullets on the server and sync them
This commit is contained in:
parent
5678ddb4c1
commit
c7c577233b
@ -15,10 +15,10 @@ func _process(delta: float) -> void:
|
||||
|
||||
|
||||
func _on_head_collision_body_part_hit(dam: Variant) -> void:
|
||||
print("head is hit" + str(dam))
|
||||
print(owner_placeholder)
|
||||
if owner_placeholder.has_method("take_damage"):
|
||||
owner_placeholder.take_damage(dam)
|
||||
#print("head is hit" + str(dam))
|
||||
#print(owner_placeholder)
|
||||
#if owner_placeholder.has_method("take_damage"):
|
||||
owner_placeholder.take_damage(dam)
|
||||
pass # Replace with function body.
|
||||
|
||||
func _get_owner() -> CharacterBody3D:
|
||||
|
@ -16,7 +16,7 @@ properties/1/spawn = true
|
||||
properties/1/replication_mode = 1
|
||||
properties/2/path = NodePath(".:health")
|
||||
properties/2/spawn = true
|
||||
properties/2/replication_mode = 1
|
||||
properties/2/replication_mode = 2
|
||||
|
||||
[sub_resource type="Animation" id="Animation_falg4"]
|
||||
length = 0.001
|
||||
|
@ -16,7 +16,7 @@ func _ready() -> void:
|
||||
if multiplayer.is_server():
|
||||
for i in GameServerManager.players:
|
||||
char = ResourceLoader.load("res://scenes/characters/placeholder.tscn").instantiate()
|
||||
char.name = "PlayerPlaceholder" + str(GameServerManager.players[i].name)
|
||||
char.name = "PlayerPlaceholder_" + str(GameServerManager.players[i].name)
|
||||
char.global_position = position
|
||||
var my_random_number = RandomNumberGenerator.new().randf_range(0.0, 5.0)
|
||||
char.global_position = position
|
||||
|
@ -26,8 +26,8 @@ func _process(delta):
|
||||
if collider != null and collider.is_in_group("target"):
|
||||
ray.get_collider().take_damage()
|
||||
if collider != null and collider.is_in_group("body"):
|
||||
print(collider)
|
||||
ray.get_collider().hit()
|
||||
print("I got hit")
|
||||
rigid_body_3d.visible = false
|
||||
particles.emitting = true
|
||||
#if ray.get_collider().is_in_group("body"):
|
||||
|
@ -256,4 +256,5 @@ func _hit_scan_damage(Collider):
|
||||
|
||||
func take_damage(dam: int):
|
||||
print("damage")
|
||||
health =- dam
|
||||
health -= dam
|
||||
print(health)
|
||||
|
Loading…
x
Reference in New Issue
Block a user