Re: Logical: Realistic Weaponry and Amunition?

While I have not released anything publicly that uses what you described, I have tinkered with the idea of ammunition. Here are my findings:
1. The weapon class is different from the projectile (ammo) class. Yes, you do need to make projectiles, but it really isn't bad.
2. Your weapon should store shots remaining, current shots in your clip, and, of course, it's damage. For ease of use, I'd also create a "fire" function that plays the weapon-associated sound. Now, here's where things become less clear.
You could, of course, add a line in your fire function that spawns a projectile, but here are some points to think about:
What is your projectile speed? How is it going to be stored? Me? I'd make it a property of the weapon, and may allow you to pass in the value to change it in the constructor (useful for multiple weapons).
Are you going to have the damage a part of the projectile class as well? If so, then that's one more thing that you need to add in your code. Another option is to mark what weapon the projectiles belong to. The disadvantage is whenever a projectile hits something, you'd have to find what weapon the it belongs to and calculate your damage that way. This could potentially add some overhead, though it likely won't cause any noticeable difference unless you have hundreds of weapons.
Moving the projectiles is also simple. If you already have the projectile speed stored somewhere, all it would take is a timer, just like you do with the cannonballs. The concept of facing would also apply to your projectiles since they're just like cannonballs without a sound

-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
  • ... AudioGames . net Forum — Developers room : redfox via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : ashleygrobler04 via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Lucas1853 via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : defender via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : defender via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : defender via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : defender via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : defender via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : defender via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : defender via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : defender via Audiogames-reflector

Reply via email to