barrier

Classes representing the parts of the skool that cause obstructions, namely walls, windows and doors.

class barrier.Barrier(barrier_id, x, bottom_y, top_y)

Abstract superclass of all obstructions.

Parameters:
  • barrier_id – The ID of the barrier.
  • x – The x-coordinate of the barrier.
  • bottom_y – The y-coordinate of the bottom of the barrier.
  • top_y – The y-coordinate of the top of the barrier.
impedes(character, distance=0, force_shut=False)

Return whether a character is impeded by this barrier.

Parameters:
  • character (Character) – The character to check.
  • distance – The maximum distance in front of the character at which the barrier should be considered an obstruction.
  • force_shut – If True, the barrier will be considered an obstruction even if it’s open; otherwise it will be considered an obstruction only when closed.
is_door()

Return whether the barrier is a door (or window). Subclasses override this method as appropriate.

Returns:False.
is_shut()

Return whether the barrier is shut. Subclasses override this method as appropriate.

Returns:True.
class barrier.Door(door_id, x, bottom_y, top_y, shut, auto_shuts)

A door that may be opened and closed.

Parameters:
  • door_id – The ID of the door.
  • x – The x-coordinate of the door.
  • bottom_y – The y-coordinate of the bottom of the door.
  • top_y – The y-coordinate of the top of the door.
  • shut – Whether the door is shut at the start of the game.
  • auto_shuts – Whether the door shuts automatically.
auto_shut()
Return whether this door should automatically shut now.
is_door()

Return whether this is a door.

Returns:True.
is_shut()
Return whether the door is shut.
move(shut)

Open or close the door.

Parameter:shut – If True, close the door; otherwise open it.
set_images(open_images, shut_images, top_left)

Define the images to use for the door when open or closed.

Parameters:
  • open_images – A list of the images to use when the door is open.
  • shut_images – A list of the images to use when the door is closed.
  • top_left – The coordinates at which to draw the image of the door.
class barrier.Wall(barrier_id, x, bottom_y, top_y)

A wall in the skool.

separates(a, b)

Return whether this wall blocks the view from one location to another.

Parameters:
class barrier.Window(window_id, x, bottom_y, top_y, shut, opener_coords)

A window that may be opened and closed.

Parameters:
  • window_id – The ID of the window.
  • x – The x-coordinate of the window.
  • bottom_y – The y-coordinate of the bottom of the window.
  • top_y – The y-coordinate of the top of the window.
  • shut – Whether the window is shut at the start of the game.
  • opener_coords – Where a character should stand to open or close the window.
barrier.AUTO_SHUT_DELAY
The delay before an auto-shutting door shuts.
barrier.SPRITE_WIDTH
Width of a sprite (used to determine when a right-facing sprite is blocked by a barrier).

Previous topic

animatorystates

Next topic

bike