animal
Classes that represent the animals in the game.
-
class animal.Animal(animal_id, command_list_id, initial_as, location)
Abstract superclass for any animals in the game.
| Parameters: |
- animal_id – The ID of the animal.
- command_list_id – The ID of the command list the animal will use.
- initial_as – The animal’s initial animatory state.
- location – The animal’s initial location.
|
-
get_command_list_id(lesson_id)
Return the ID of the command list used by the animal.
| Parameter: | lesson_id – The ID of the current lesson (ignored - animals do
not follow a timetable). |
-
is_blocked(distance=0)
Return True if the animal can proceed no further in the current
direction, False otherwise.
| Parameter: | distance – The maximum distance to check in front of the animal. |
-
is_eric_nearby()
- Return whether Eric is on the same floor as and close to this
animal. The answer is used by the frog to decide whether to hop.
-
is_frog()
Return whether this animal is a frog.
-
is_mouse()
Return whether this animal is a mouse.
-
class animal.Frog(frog_id, command_list_id, initial_as, location)
A frog.
| Parameters: |
- frog_id – The ID of the frog.
- command_list_id – The ID of the command list the frog will use.
- initial_as – The frog’s initial animatory state.
- location – The frog’s initial location.
|
-
check_heads()
- Check whether this frog has hit anybody’s head, and take appropriate
action (such as handing the safe key to Eric) if so.
-
fall_from_cup(cup)
Make this frog fall out of a cup.
-
insert_into_cup(cup)
Insert this frog into a cup. The frog will be trapped until Eric
knocks the frog out.
-
is_frog()
Return whether this animal is a frog.
-
is_sitting()
- Return whether the frog’s current attitude allows it to be caught
by Eric. This will be True unless the frog is hopping.
-
class animal.Mouse(mouse_id, command_list_id, initial_as, location, immortal=True)
A mouse.
| Parameters: |
- mouse_id – The ID of the mouse.
- command_list_id – The ID of the command list the mouse will use.
- initial_as – The mouse’s initial animatory state.
- location – The mouse’s initial location.
- immortal – If True, the mouse will not disappear until Eric catches
it; otherwise it will die (disappear from the game) after
a certain time.
|
-
die()
- Kill this mouse. The mouse is removed from the game, never to be
seen again.
-
is_mouse()
Return whether this animal is a mouse.
-
is_sitting()
- Return whether the mouse’s current attitude allows it to be caught
by Eric. For a mouse, this is always True.
-
scare_people()
- Alert any nearby musophobes of this mouse’s presence.
-
animal.ERIC_PROXIMITY
- Minimum distance away Eric must be to be considered nearby (used to decide
whether the frog should hop).
-
animal.FROG_X
- x-coordinate of the frog within its SIT sprite (used for placement in a cup
and detecting collision with a character’s head).
-
animal.FROG_Y
- y-coordinate of the frog within its SIT sprite (used for placement in a cup
and detecting collision with a character’s head).