I am studying GODOT and making my first 2D top-down shooter game and I have a question: how best to make a weapon? According to all the guides on the internet, people make guns and bullets scenes and then export them. But what if I want to have different bullets for different weapons? As a rule, they differ in sprites, effects, etc. It is better to export a scene with one type of bullet to a certain weapon or export a scene, for example, to a game character. Or is there another way at all?
It just turns out to be a mess if I export all the scenes to the player
This is probably a good use case for custom resources. You could make a Gun resource script, and then each Gun resource can have its own bullet sprite, bullet speed, firing rate, a PackedScene for visual effects, etc. etc.
Here is relevant documentation, and you can probably also find youtube tutorials if you search for ‘godot custom resource’.
I did this with a helicopter tech demo with two weapons - a bomb and a rocket launcher. The bomb and rocket are separate scenes:
var rocket = preload("res://scenes/rocket.tscn")
var bomb = preload("res://scenes/bomb.tscn")
You can view some of the code on my YouTube channel: