barrier¶
Classes representing the parts of the skool that cause obstructions, namely walls, windows and doors.
- class pyskool.barrier.Barrier(barrier_id, x, bottom_y, top_y, climb_phases=(), fly_phases=())¶
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 pyskool.barrier.Door(door_id, x, bottom_y, top_y, shut, auto_shut_delay, climb_phases, fly_phases=())¶
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_shut_delay – The delay before the door shuts automatically; if zero or negative, the door will not shut automatically.
- climb_phases – The sequence of animation phases to use for Eric if he climbs over the door when it’s shut.
- fly_phases – The sequence of animation phases to use for Eric if he he flies over the door after hitting it while standing on the saddle of the bike.
- auto_shut()¶
Return whether this door should automatically shut now.
- build_images()¶
Build the images for the barrier. This method is called after rescaling the screen or loading a saved game.
- get_images()¶
Return a 2-tuple containing a list of images of the current state of the door, and the coordinates at which to draw the door.
- 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.
Parameters: shut – If True, close the door; otherwise open it. Returns: A 2-tuple containing a list of images of the current state of the door, and the coordinates at which to draw the door.
- 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 pyskool.barrier.Wall(barrier_id, x, bottom_y, top_y, climb_phases=(), fly_phases=())¶
A wall in the skool.
- separates(a, b)¶
Return whether this wall blocks the view from one location to another.
Parameters: - a (Location) – The first location.
- b (Location) – The other location.
- class pyskool.barrier.Window(window_id, x, bottom_y, top_y, shut, opener_coords, phases, not_a_bird)¶
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.
- phases – The animation phases to use for Eric if he jumps out of the window.
- not_a_bird – The ID of the command list Mr Wacker should switch to when Eric hits the ground after jumping out of the window; if not blank, Eric will be paralysed when he hits the ground.