Confused about mutually dependant classes
From: Peter Ruderman (pruderman_at_rogers.com)
Date: 05/19/04
- Next message: Daniel Parker: "Re: Downcasting - whats the problem?"
- Previous message: Michael Rauscher: "Re: UML "OR" Composition Question"
- Next in thread: Daniel T.: "Re: Confused about mutually dependant classes"
- Reply: Daniel T.: "Re: Confused about mutually dependant classes"
- Reply: Kevin Cline: "Re: Confused about mutually dependant classes"
- Reply: H. S. Lahman: "Re: Confused about mutually dependant classes"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 18 May 2004 22:53:06 GMT
Hello,
I'm writing a game (though it isn't a serious project). The game contains
creatures, each of whom has a number of hit points. Hit points are lost by
taking damage, and creatures may have various ways of modifying the amount
of damage they receive. In addition, damage may have other effects
unrelated to the creature itself. For example, fire damage might destroy a
creature's flammable possessions.
I'm confused about how to design the classes to support this system. It
seems appropriate to have a damage class that abstracts the various things
damage can do, but how do I divide the work of dealing damage between the
creature class and the damage class? Should damage be aware of the various
ways it can be resisted? Should creatures be aware of all the things damage
can do (besides reducing hit points)? Should damage deal itself to
creatures, or should creatures receive damage? How do I design a mutual
interface such that only these two classes can use it?
Any help would be greatly appreciated.
- Peter Ruderman
- Next message: Daniel Parker: "Re: Downcasting - whats the problem?"
- Previous message: Michael Rauscher: "Re: UML "OR" Composition Question"
- Next in thread: Daniel T.: "Re: Confused about mutually dependant classes"
- Reply: Daniel T.: "Re: Confused about mutually dependant classes"
- Reply: Kevin Cline: "Re: Confused about mutually dependant classes"
- Reply: H. S. Lahman: "Re: Confused about mutually dependant classes"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|