Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | DefyingRelativity |
Hello guys, i’ve a problem and i’ve read every question related to this problem (cause i’ve seen a lot of this)
I’m trying to shoot bullets out of two cannons but i dont want them to follow the ship’s position cause that’s silly
Down here is my shoot function, setting the bullets parent to anything other than the ship doesn’t seem to draw them on the screen. they update and have the expected coords, but don’t work otherwise
I’m banging my head against the wall in this one, tried every solution i’ve seen to no avail, short of making the top-est node spawn the bullets instead of the player node.
Any insight would be appreciated!
func shoot():
fr-=1
if fr == 0:
var bul1 = bullet.instance()
var bul2 = bullet.instance()
bul1.position = $cannon1.position
bul2.position = $cannon2.position
get_parent().add_child(bul1)
get_parent().add_child(bul2)
# i have also tried this
#$bulletHolder.add_child(bul1)
#$bulletHolder.add_child(bul1)
print(str(bul1.get_parent()))
print(str(bul2.position) +" " +str($cannon2.position))
print(str(bul1.position) +" " +str($cannon1.position))
fr = fire_rate