![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | Gokudomatic2 |
![]() |
Old Version | Published before Godot 3 was released. |
Hello,
I’m implementing a game where the player shoot lot of bullets per sec. Those bullets are dynamic (lot of different kinds of bullets) and can become a bit complex (with multiple children). What is the best way to create very quickly those bullets in GDScript? Knowing that there are some conditions to know which kind of bullet to shoot, it wouldn’t be performant to go through those conditions every time.
I’ve seen there’s a “duplicate” function in the Node. Is it more or less efficient than instancing every time?
Thanks in advance for your answers.
There is a “bullet shower” demo BTW…
Bojidar Marinov | 2016-03-25 14:09
Thanks, Bojidar. Alas I already use the trick in this demo, which is to use an Area instead of a RigidBody. What I need is a way to quickly create dozen instances of the same scene without having to reconfigure it every time. For the moment, I guess using a pool of pre-created instances would be the most efficient. I created them in advance and simply add them in the main scene when I need some. And I refill later the pool in a background process.
Gokudomatic2 | 2016-03-26 07:12