animal¶
Classes that represent the animals in the game.
- class pyskool.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.
- Parameters:
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.
- Parameters:
distance – The maximum distance to check in front of the animal.
- is_frog()¶
Return whether this animal is a frog.
- Returns:
False.
- is_mouse()¶
Return whether this animal is a mouse.
- Returns:
False.
- class pyskool.animal.Frog(frog_id, command_list_id, initial_as, location, sit_xy, eric_proximity)¶
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.
sit_xy – The coordinates of the frog within its sprite when it’s sitting (used for collision detection and placement in cups).
eric_proximity – The minimum distance from the frog that Eric can be before it will try to hop away.
- bounce_off_head()¶
Make the frog bounce off a character’s head.
- 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.
- Parameters:
cup – The cup.
- insert_into_cup(cup)¶
Insert this frog into a cup. The frog will be trapped until Eric knocks the frog out.
- Parameters:
cup – The cup.
- is_catchable_at(x, y)¶
Return whether the frog is currently catchable at a given location.
- Parameters:
x – The x-coordinate of the location.
y – The y-coordinate of the location.
- is_eric_nearby()¶
Return whether Eric is on the same floor as and close to the frog. The answer is used by the frog to decide whether to hop.
- is_frog()¶
Return whether this animal is a frog.
- Returns:
True.
- sit()¶
Make the frog assume a sitting position.
- class pyskool.animal.Mouse(mouse_id, command_list_id, initial_as, location, sprite_xy, 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.
sprite_xy – The coordinates of the mouse within its sprite (used for detecting whether Eric has caught it).
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_catchable_at(x, y)¶
Return whether the mouse is currently catchable at a given location.
- Parameters:
x – The x-coordinate of the location.
y – The y-coordinate of the location.
- is_mouse()¶
Return whether this animal is a mouse.
- Returns:
True.
- scare_people()¶
Alert any nearby musophobes of this mouse’s presence.