0 votes

I have this boss enemy that shoots 5 bullets when this function is triggered. The bullets gets spawned but the positioning of then is always wrong, I want it to spawn bullet in 5 spawn positions which are children of the boss but it spawns them at origin. I tried changing the line that ends with "*********" a lot and tried every combination of "position" and "global_position".

I use the same logic for player bullets(only diffrence there that player shoots 1 at a time) and it works fine but I really have no idea why it doesn't work for boss enemy.

 for i in $Shoot.get_children():
    var bullet_ins = bullet.instance()

    bullet_ins.global_position = i.global_position***
    bullet_ins.rotation = i.rotation

    bullet_ins.active = true

    get_parent().get_parent().add_child(bullet_ins)

    bullet_ins.update_stat(5, 20000, 3)
    print("shoot")
Godot version latest
in Engine by (74 points)

1 Answer

0 votes

set position after adding it as a child

by (7,925 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.