Heya, i'm trying to make a space invader type game but when i try to spawn the bullet it doesn't spawn where i want it to, instead it spawns in a set location, i'm trying to get it to spawn ontop of the playership.
here's my code as of now.
Game:
extends Node2D
var BulletScene = preload("res://PlayerBullet.tscn")
onready var ship = $PlayerShip
func spawn_bullet():
var bullet = BulletScene.instance()
bullet.global_position = $PlayerShip.position
add_child(bullet)
func _process(delta):
if Input.is_action_pressed("shoot"):
spawn_bullet()
What do i do?