WIP: Spawn bullets on the server and sync them

This commit is contained in:
2025-01-26 19:34:59 +01:00
parent ed53f156c0
commit dbfcf573c2
4 changed files with 8 additions and 5 deletions

View File

@ -26,11 +26,14 @@ func _ready() -> void:
$MultiplayerSpawner.spawn(char)
players.add_child(char)
var bullet_amount: int = 0
func spawn_bullet(position):
print("spawning a bullet")
var node: Node3D = ResourceLoader.load("res://scenes/weapon/bullet.tscn").instantiate()
node.position = position.global_position
node.transform.basis = position.global_transform.basis
node.name = str(bullet_amount)
bullet_amount += 1
$BulletSpawner.spawn(node)
$Bullets.add_child(node)
# Called every frame. 'delta' is the elapsed time since the previous frame.