room¶
Classes that represent the rooms in the skool and their furniture.
- class pyskool.room.Blackboard(screen, top_left, size, chalk, skool_image)¶
A blackboard in a classroom.
- Parameters:
- beside(character)¶
Return whether a character is standing beside the blackboard.
- Parameters:
character (
Character) – The character to check.
- build_images()¶
Build the images for the blackboard. This method is called after rescaling the screen or loading a saved game.
- clear(blit=False)¶
Mark this blackboard as clean.
- Parameters:
blit – If True, the blackboard surface will be blitted clean too; otherwise it will be left alone.
- is_dirty()¶
Return whether anything is written on the blackboard.
- newline()¶
Start a new line on the blackboard.
- restore()¶
Restore the image of this blackboard. This method is used after restoring a saved game.
- shows(text, in_order=True)¶
Return whether the blackboard displays all the characters in a given piece of text.
- Parameters:
text – The text to look for.
in_order – If True, return True only if the order of the characters written on the board matches too.
- wipe(column)¶
Wipe a column of the blackboard clean.
- Parameters:
column – The column to wipe clean.
- write(char)¶
Write a character on the blackboard.
- Parameters:
char – The character to write.
- class pyskool.room.Chair(room, x)¶
A seat in a classroom.
- Parameters:
room (
Room) – The room the chair is in.x – The x-coordinate of the chair.
- seat(character)¶
Mark the chair as being occupied by a character.
- Parameters:
character (
Character) – The character sitting in the chair.
- vacate()¶
Mark this chair as vacant.
- class pyskool.room.Desk(room, x)¶
A desk (that can be opened) in a classroom.
- Parameters:
room (
Room) – The room the desk is in.x – The x-coordinate of the desk.
- empty()¶
Mark the desk as empty.
- insert(item)¶
Insert an inventory item (water pistol or stinkbombs) into the desk.
- Parameters:
item – The ID of the item to insert.
- class pyskool.room.NoGoZone(zone_id, min_x, max_x, bottom_y, top_y)¶
A region of the skool in which Eric is never allowed to be.
- Parameters:
zone_id – The zone’s unique ID.
min_x – The x-coordinate of the left edge of the zone.
max_x – The x-coordinate of the right edge of the zone.
bottom_y – The y-coordinate of the bottom edge of the zone.
top_y – The y-coordinate of the top edge of the zone.
- contains(x, y)¶
Return whether a given location is inside the zone.
- Parameters:
x – The x-coordinate of the location.
y – The y-coordinate of the location.
- class pyskool.room.Room(room_id, name, top_left, bottom_right, get_along)¶
A classroom or some other region of the skool that Eric is expected to show up in when the timetable demands it.
- Parameters:
room_id – The unique ID of the room.
name – The name of the room (as it should appear in the lesson box).
top_left – The coordinates of the top-left corner of the room.
bottom_right – The coordinates of the bottom-right corner of the room.
get_along – If True, Eric will be told to get along if he’s found in this room when the timetable doesn’t say he should be in it.
- add_blackboard(screen, top_left, size, chalk, skool_image)¶
Add a blackboard to the room.
- add_chair(x)¶
Add a chair to the room.
- Parameters:
x – The x-coordinate of the chair.
- add_desk(x)¶
Add a desk (that can be opened) to the room.
- Parameters:
x – The x-coordinate of the desk.
- beside_blackboard(character)¶
Return whether a character is standing beside the blackboard in this room.
- Parameters:
character (
Character) – The character to check.
- blackboard_dirty()¶
Return True if the room has a blackboard and it is dirty, False otherwise.
- build_blackboard_images()¶
Build the images for the blackboard in this room (if any). This method is called after rescaling the screen or loading a saved game.
- chair(character, check_dir=True)¶
Return the chair in this room that a character is next to, or None if the character is not next to a chair.
- Parameters:
character (
Character) – The character to check.check_dir – If True, return a chair only if the character is beside one and facing the right way to sit in it; otherwise disregard the direction in which the character is facing.
- contains(character)¶
Return whether a character is in this room.
- Parameters:
character (
Character) – The character to check.
- desk(character)¶
Return the desk in this room that a character is sitting at, or None if the character is not sitting at a desk.
- Parameters:
character (
Character) – The character to check.
- get_blackboard_writer()¶
Return the character who wrote on the blackboard in this room, or None if either the room has no blackboard, or the blackboard is clean.
- get_chair_direction()¶
Return the direction in which the chairs in this room are facing.
- Returns:
-1 if the chairs are facing left, 1 if they are facing right, or None if there are no chairs in the room.
- get_next_chair(character, move_along, go_to_back)¶
Return the chair that a character should find and sit in.
- Parameters:
character (
Character) – The character looking for a chair.move_along – If True (and go_to_back is False), return the next seat along if the character is currently beside one; otherwise return the seat closest to the character.
go_to_back – If True, return the back seat in the room.
- Returns:
A 2-tuple containing the target chair and the direction it faces (-1 or 1), or (None, None) if there are no chairs.
- has_blackboard()¶
Return whether the room has a blackboard.
- restore_blackboard()¶
Restore the image of the blackboard in this room. This method is used to draw the contents of a blackboard afresh after restoring a saved game.
- wipe_blackboard()¶
Wipe the blackboard in the room (if any) and mark it as clean.