When you say that you’ve “been making separate bullets”, what do you mean?
You probably want to simply instantiate a single bullet scene when/as needed, so really no different than managing lots of things in Godot.
And, if you do that, you really just need to set up the single scene to work as desired in conjunction with the player scene and then every created instance will “just work”.
So, no need to set up collision detection “for each individual bullet”.
I’ve just been copying and pasting the bullet and then the code and changing it so it shoots out and moves in a certain direction. I’m fairly new to most of this so I’m not sure what instantiating is but this method does seem like a much more efficient way than what I was trying to do.
SaphyrX173 | 2023-05-03 19:39
Yeah, that’s definitely not the way to go. Likely, you just need a few scenes, like
Bullet, and maybe
Main (or similar).
You can create the
Player scene completely independent from the others and attach a script to handle “player things” like movement.
Next, create a single
Bullet scene complete with an appropriate
CollisionShape2D, and script for handling “collisions” with the player.
Main scene can be your “game”. In it, you’d place an instance of you player.
And, when/as appropriate, you’d instantiate new copies of the
Bullet scene, which would come with all the behaviors of the single
Bullet scene you already defined - including appropriate collision detection.
You might wan to spend a little time watching some tutorial videos and looking through the docs. In the long run, it’ll save you a lot of effort.
jgodfrey | 2023-05-03 20:05