I’m currently developing a twin stick shooter and I’m wondering how I would deal with multiple weapons?
For example, by default the players weapon shoots normal bullets, however after getting an upgrade, rockets are also shot simultaneously but at a different fire rate. I can make the functionality for multiple weapons just fine but I’m not sure how I would deal with them being dynamically added to the character in game, and also having things such as different fire rates etc.
Any help would be appreciated, thanks.
for that setup i would make each weapon its own actor component with a fire rate float and a looping timer. the base twin stick pawn just holds an array of active weapon comps, and adding a pickup is add component then init. each comp runs its own timer so bullets and rockets naturally fire at different rates without one blocking the other.
if you dont want to wire all that pooling and switching yourself, Top Down Space Shooter Game Template, a modular Blueprint and C++ starter project for Unreal Engine 5, already has that weapon switch and projectile setup in it: Top Down Space Shooter Game Template — Modular Blueprint & C++ Starter Project | Fab
pickup logic is then just append to the array, way cleaner than hardcoding slots.
whats the point of answering these questions after 4 years bud?
Why not? someone might search for the same problem, he can find an answer instead of an empty post.