Ok so I would like someone to help me understand why my code isn't working and if they can give me an answer to fix it. So basically I'm new to coding and I would some to look at my code and tell me why the bullets are not spawning.
var speed = 200
onready var obj = get_parent().get_node("Player")
onready var fireDelayTimer = $fireDelayTimer
export var fireDelay: float = 1
const bulletE1 = preload("res://EnemyBullet1.tscn")
var dir = (obj.global_position - global_position).normalized()
move_and_collide(dir * speed * delta)
var bullet = bulletE1.instance()
bullet.position = $Position2D.global_position
bullet.velocity = obj.position() - bullet.position
This is all the code for the enemy which I would like to get the bullets to spawn in. This is also the same code i use for the player just with a few tweaks, however only the player bullets work and not the enemy's. If someone could tell me why its not working that would be appreciated.