#Designing a weapon system

4 messages · Page 1 of 1 (latest)

turbid crane
#

I am currently making a shooter in Bevy. And I'd like to create a weapon system, the player could have any number of weapons but only select one weapon at a time. You can shoot a weapon with the left click. I'd like to make the function that actually fires the weapon to be a system (which improves parallelism and makes getting resources and components easier)

turbid crane
#

I also want to support passive weapons (Weapons that do something without being selected, or even weapons that cannot be selected at all)

turbid crane
#

Ok so I think I got something that I like:

  • Every weapon is a component on the player
  • Theres a SelectedWeapon component that stores the TypeId of the selected weapon
  • Most weapons have a system that checks if its the selected weapon and the fire button is pressed
  • If all conditions are passed, fire the weapon
winter veldt