Fix the aiming and bullet creation
This commit is contained in:
@ -1,22 +1,31 @@
|
||||
extends Node
|
||||
|
||||
class_name BulletSpawnerController
|
||||
# This script shoud be able to find the player
|
||||
|
||||
var players: Dictionary = {}
|
||||
|
||||
func spawn_a_bullet():
|
||||
# -- Get
|
||||
pass
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
var world: MapController = find_parent("Map")
|
||||
# Get all the players on the server and add
|
||||
# corresponding nodes to them
|
||||
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
pass
|
||||
|
||||
func _get_spawner() -> MultiplayerSpawner:
|
||||
return $MultiplayerSpawner
|
||||
|
||||
func _get_root() -> Node3D:
|
||||
return $Bullets
|
||||
|
||||
# -- TODO: Better bullet naming handler
|
||||
var bullet_amount: int = -2147483647
|
||||
func spawn_bullet(starting_point: Node3D, speed: int, damage: int):
|
||||
var node: Node3D = ResourceLoader.load("res://scenes/weapon/bullet.tscn").instantiate()
|
||||
node.position = starting_point.global_position
|
||||
node.transform.basis = starting_point.global_transform.basis
|
||||
node.name = str(bullet_amount)
|
||||
node.speed = speed
|
||||
node.damage = damage
|
||||
bullet_amount += 1
|
||||
_get_root().add_child(node)
|
||||
|
Reference in New Issue
Block a user