djog / djog_unos_2019

Project by the Uno's at DJOG 2019-2020
https://github.com/djog/dojo
GNU General Public License v3.0
3 stars 1 forks source link

Create new bullet #105

Closed robkruger closed 4 years ago

robkruger commented 4 years ago

Currently, the machine gun nests shoot shells, which isn't realistic of course. We need new bullets.

Create a enum class named ProjectileType, add shell, bullet and tracer in there and rename the Shell class to Projectiles. Modify that class so that it has a variable which holds it's type and it has a custom texture for all the bullet types. Another option, although less efficient, is to create a new class named Bullet and copy almost all the code from the shell class but with another texture.

DynCoder commented 4 years ago

Projectile

rijkvp commented 4 years ago

👍 but is a tracer a projectile?

DynCoder commented 4 years ago

Yes, It's a type of bullet

richelbilderbeek commented 4 years ago

@robkruger: you suggest to use inheritance here with 'Projectile' as the base class. I strongly advice against it, as inheritance is hard to use correctly and easy to use incorrectly :rainbow: .

An easy alternative is to use a 'Projectile' class, with an enum type called 'type'. This is the approach we used in Nature Zen. It is simple and scales better (i.e. it prevents a class explosion).

OTOH, the problem is simple enough to try it out in this context, as it will be relatively easy to undo at the moment Team Octane regrets the decision to use it.

I leave it up to you (or the whole Team) to pick either:

robkruger commented 4 years ago

@richelbilderbeek I meant the Nature Zen approach, but maybe didn't explain it too well...

richelbilderbeek commented 4 years ago

Cool, than you have my complete blessing! Good luck implementing it :+1:

rijkvp commented 4 years ago

I'll create a projectile system with enums. It'll be a bit more complex so I'll remove the good first issue label.

rijkvp commented 4 years ago

I created a projectile system & merged.