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)
|
||||
|
@ -1,8 +1,12 @@
|
||||
[gd_scene format=3 uid="uid://sh5diukewgs5"]
|
||||
[gd_scene load_steps=2 format=3 uid="uid://sh5diukewgs5"]
|
||||
|
||||
[ext_resource type="Script" path="res://scenes/maps/base/bullet_spawner/bullet_controller.gd" id="1_ohxtg"]
|
||||
|
||||
[node name="BulletSpawner" type="Node3D"]
|
||||
script = ExtResource("1_ohxtg")
|
||||
|
||||
[node name="MultiplayerSpawner" type="MultiplayerSpawner" parent="."]
|
||||
spawn_path = NodePath("../Node3D")
|
||||
_spawnable_scenes = PackedStringArray("res://scenes/weapon/bullet.tscn")
|
||||
spawn_path = NodePath("../Bullets")
|
||||
|
||||
[node name="Node3D" type="Node3D" parent="."]
|
||||
[node name="Bullets" type="Node3D" parent="."]
|
||||
|
Reference in New Issue
Block a user