pyherc.generators.level.partitioners.section
Classes to represent division of levels
Section
-
class pyherc.generators.level.partitioners.section.Section(corner1, corner2, level)
Class representing a single section in a level
-
add_room_connection(location, direction)
Adds connection to the room
Room connections are used to connect rooms to edge of Sections
- Args:
- location: (loc_x, loc_y) where to add the Connection
direction: direction where this connections leads
- Note:
- Coordinates are given relative to section origo
-
connect_to(section)
Connect this Section to another
- Args:
- section: Section to connect to
-
connected
Readonly property for connection status of the section
- Returns:
- True if section is connected, otherwise False
-
connections
Readonly property to access connections of the section
-
corners
Corners of this Section.
-
get_border()
Get list of locations, defining borders of this Section
- Returns:
- List of (loc_x, loc_y) defining borders
- Note:
- Coordinates are given relative to level origo
-
get_common_border(another_section)
Get list of locations that define common border between two Sections
Border is placed on the edge of this Section
- Returns:
- List of (loc_x, loc_y) defining common border
- Note:
- Coordinates are given relative to level origo
-
get_opposing_point(location)
Calculate which of this Section’s points corresponds to the point given
on the other side of the common border
- Args:
- location: (loc_x, loc_y) defining point on the other side
- Returns:
- (loc_x, loc_y) if corresponding point is found, False otherwise
- Note:
- Coordinates are given relative to level origo
-
has_unconnected_neighbours()
Check if any of this Sections neighbours is unconnected
- Returns:
- True if unconnected neighbour is found, otherwise false
-
height
Readonly property to find height of the section
-
left_edge
Readonly property to find leftmost point of the section
-
neighbours
Readonly property to access neighbours of the section
-
room_connections
Readonly property to access connections to the room
-
set_floor(location, tile)
Set floor at given location
- Args:
- location: (loc_x, loc_y) location to set the tile
tile: ID of the tile to use
- Note:
- Coordinates are given relative to section origo
-
set_wall(location, tile)
Set wall at given location
- Args:
- location: (loc_x, loc_y) location to set the tile
tile: ID of the tile to use
- Note:
- Coordinates are given relative to section origo
-
top_edge
Readonly property to find topmost point of the section
-
unconnected_neighbours()
Get list of unconnected neighbours
- Returns:
- List of unconnected neighbours
-
width
Readonly property to calculate width of the section