Games::Roguelike::Item - Roguelike item object
package myItem; use base 'Games::Roguelike::Item'; $i = myItem->new($area, sym=>'!', x=>5,y=>6); # creates an item at location 5, 6 # with symbol '!', inside area $area
Item object used by drawing routines in Roguelke::Area
$container is usually an "area" or "mob" or another "item" object.
At a minimum, it must support the additem and delitem methods.
The "new" method automatically calls additem on the container.
Options include:
sym : symbol this item is drawn with color : color this item is drawn with x : map location of item y : map location of item
Other options are saved in the hash as "user defined" options.
Return the item's x/y members only if the item is in an ::Area object,
Otherwise, return the container's x and y members.
Direct access to the $item->{x}/{y} members is encouraged if you don't care how it's contained.
Sets the container for an item, returns 0 if it's already contained within that continer.
Dies if the container has no {items} list (ie: can't contain things)
** Should only ever be called** - by the container's "additem" method, and - only if the container is derived from ::Area, ::Mob or ::Item.
(This can & will be made generic at some point)
Add item to reside within me. Override this to make backpacks, etc.
Return value 0 = can't add, too full/or not a backpack Return value 1 = add ok Return value -1 = move occured, but not added
Default implementation is to return "0", cannot add.
Deletes item from within me. Override this to make backpacks, etc.
Games::Roguelike::Area
To install Games::Roguelike::Mob, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Games::Roguelike::Mob
CPAN shell
perl -MCPAN -e shell install Games::Roguelike::Mob
For more information on module installation, please visit the detailed CPAN module installation guide.