- Edited
I have nodes set up that shoot bullets so I can attach them to my enemy, and have them shoot from wherever the node is placed. problem is, if I try to make the bullet equal to the position of the node then it starts firing from a position relative to the map instead. if I do get_parent().position it fires from the correct place, but it's from the center of the enemy. here's my code and a screenshot example of what's happening:
func create_new_bullet():
var new_bullet = blood_shot.instantiate()
new_bullet.position = position // if I change this to get_parent().position it's the right place but the wrong relative place.
new_bullet.rotation = 0
new_bullet.get_node("Sprite2D").flip_h = randi_range(0,1) // this is just for visual variety
new_bullet.scale = Vector2(0.5,0.5)
main_node.add_child(new_bullet) // this parents it to the world node after setting everything up so it doesn't rotate with the enemy's body
the bullet is supposed to come from the nodes I placed on the enemy's eyes that shoot bullets, but instead it's from the world origin. did I do something weird without realizing it?