On Nov 8, 10:32 pm, 7stud -- <bbxx789_0... / yahoo.com> wrote:
[...]
> module Creature
>   def kingdom=(some_kingdom)
>     @kingdom = some_kingdom
>   end
>
>   def kingdom
>     @kingdom
>   end
> end
>
> class Dragon
>   include Creature
> end
>
> d = Dragon.new
> d.kingdom = 'Mordor'
> puts d.kingdom
>
> --output:--
> Mordor

This is interesting because it brings up the next problem:
locations.  In this case, kingdoms.  I changed the design a bit so
that Creature is a class from which Dragon and so forth inherit.  One
approach I was thinking about would be to give each creature instance
a few objects, such as:  statistics, kingdom and inventory.  (Right
now the "statistics" portion is built in directly to the class, I'm
considering making a class for these traits.)

Each Creature needs a kingdom (even if it's "banished" or something),
and, of course, a kingdom can "hold" many creature objects.  In
tables, the "kingdom" table would have a one-to-many relation to the
"creatures" table.

Just thinking outloud....



-Thufir