Sign in to follow this  
Artum

2D RPG Ranged Damage Design Question

Recommended Posts

Artum    136
Hey all. I've got a design question for the board. I'm creating a 2D RPG game for a few friends and myself to play. It's nothing fancy, just a little dungeon crawler for a few nerds to play when we get bored. I'm using C++, Dev-C++, and SDL for graphics and sound (well, eventually sound :-P). I've setup a spell class that holds information such as spell name, mana cost, and damage- ya know, the norm. I've also set up a projectile class so I can easily keep track of all moving projetiles. The class has information such as range, speed, and position. Both classes of course have a crap-ton of other variables but you get the idea. My question is should I pass the damage from the spell template to the projectile to be inflicted on the unit when a collision is detected or should I keep the damage in the spell class and just use the projectile class for positioning? Any comments or ideas would be much appreciated. Let me know if I haven't given enough information. Thanks in advance, -Artum.

Share this post


Link to post
Share on other sites
Deleter    169
It seems to me passing the damage to the projectile class would be more encapsulated. That way your projectile class can work for any type of damage regardless of if its for spells, bows, traps, etc.

Share this post


Link to post
Share on other sites
Artum    136
Awesome, thanks for the input. I've been using the projectile to carry the information so far and it's been working just fine. Sometimes it's just nice to get a second oppinion.

Thanks again,
-Artum.

Share this post


Link to post
Share on other sites
Kylotan    9983
This is really for our programming forums rather than the design forum, so I'll move it in case anybody else has any input.

Personally I would keep the damage resolution in the spell class. Putting it in the projectile makes sense when it's just a constant value or a simple range, but if you want to do something complex like draining life from the victim and adding it to the caster, or charming the victim, or anything else that relates the victim back to the caster somehow, you'll want to preserve that link.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this