#How do I spawn new instances of objects?

4 messages · Page 1 of 1 (latest)

rancid siren
#
extends Node3D

@export var player : Node3D
@export var bullet : PackedScene
# Called when the node enters the scene tree for the first time.
func _ready():
    pass # Replace with function body.


# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
    look_at(player.global_transform.origin, Vector3.UP)
    var new_bullet = bullet.instance()

#

this is the script I have right now

sharp tendon
#

it's bullet.instantiate()

#

and you'll probbaly want to actually add the bullet to the scene with add_child(bullet)