[DGD] players, inheritance, cloning, a better solution?
Robert Forshaw
iouswuoibev at hotmail.com
Fri Apr 2 01:53:57 CEST 2004
I have an object called primary_object.c, which contains behaviour code for
all objects existing in the game world (rooms, items, and entities). This
object was not intended for inheritance, but rather it would be cloned have
each clones' behaviour defined by configuration files. I also want actual
players to be primary objects.
Now, I could put all the code for interactivity into the primary_object, but
this seems a rather inefficient solution since most objects wouldn't be
making any use of the interactive code. So I've got a seperate object,
called player.c. But if I inherit primary_object in order to adopt its
behaviour, it won't be clonable any longer.
My solution has been to make another file, _primary_object.c for lack of a
better name, all that does is inherit primary_object.c. So primary_object.c
becomes a library and _primary_object.c the clonable.
I'm just wondering if anyone can spot a more attractive solution than the
one I've just described, as it seems rather 'hackish', if you know what I
mean.
_________________________________________________________________
Find a cheaper internet access deal - choose one to suit you.
http://www.msn.co.uk/internetaccess
_________________________________________________________________
List config page: http://list.imaginary.com/mailman/listinfo/dgd
More information about the DGD
mailing list