Games::PMM::Monster - represents a Monster in a PMM Game
use Games::PMM::Monster; use Games::PMM::Arena; my @commands = ( scan charge attack ); my $monster = Games::PMM::Monster->new( commands => \@commands ); my $arena = Games::PMM::Arena->new(); $arena->add_monster( $monster, x => 0, y => 0 );
Games::PMM::Monster represents a Monster that battles in a PMM game. It contains all of the monster state and behavior.
Creates and returns a new Monster object. Any
commands provided will be passed straight through to a Games::PMM::Monster::Commands object.
Returns the identifier of this Monster. All Monsters created within a program have a unique identifier.
Returns the Monster's current health. Monsters start with three points of health.
Removes a point of health from the Monster and returns the current value.
Returns the direction the Monster is currently facing. This is one of the four cardinal directions.
Returns the next command the Monster would like to execute. This may return a false value if the Monster is looping around its entire command set. See Games::PMM::Monster::Commands for more information.
Turns the Monster in the given
Returns information about the closest other Monster this Monster has seen. Data is returned as a hash reference with keys of
y coordinates. You'll probably only use this if you are extending this class.
Moves or turns the Monster toward the given coordinates. Monsters prefer to move in the direction they are facing, but they will turn if they can go no further in the current direction.
Moves or turns the Monster away from the given coordinates. Monsters prefer to move along the axis it is facing (tending to back up when retreating), but will turn if it can go no further in the current direction.
No known bugs.
Copyright (c) 2003, chromatic. All rights reserved. This module is distributed under the same terms as Perl itself, in the hope that it is useful but certainly under no guarantee.