Question about OOP

Hello. First, I wanna apologize for the very very bad title, but I really don’t know how to fit my problem into a title. This question probably also is a bit confusing, so please ask me if you don’t understand me.
This might also be the dumbest question you’ve ever heard, as I don’t have a lot of experience with OOP.

My goal:
I want to create a gun System/Engine using OOP.

The issue:
I am not sure if I should create a class for every gun, or have a Gun class and create a new Instance of that for every gun.
If I use second, the gun class would have values like: model, maxAmmo, reloadTime, reloadAnim, holdAnim, modes, etc… That’s great and all, but…

I would also like to have an instance of a gun class for every player, so I could also store ammo, state, mode and have functions like :Reload(), :SingleShoot, :StartShooting(), :StopShooting(), etc…

For that, I would have to create a class for every gun, and an instance of that class for every player, as far as I know.

The question:
How can I achieve, what I described? Is it even possible?

Thanks in advance - Sonnenroboter

Can you explain OOP so when can maybe help?

I can’t… But they can: All about Object Oriented Programming

1 Like

You could just create a class for Gun in itself, and have every gun EXTEND that class, inheriting the properties of Gun, while being able to change them, e.g changing damage, propulsion.


Ok, apparently I am dumb.

I’ll go for that, I really appreciate your help. :slight_smile: