pygamelib.engine.Board

class pygamelib.engine.Board(**kwargs)

A class that represent a game board.

The board is being represented by a square matrix. For the moment a board only support one player.

The Board object is the base object to build a level :
you create a Board and then you add BoardItems (or objects derived from BoardItem).
Parameters:
  • name (str) – the name of the Board
  • size (list) – array [width,height] with width and height being int. The size of the board.
  • player_starting_position (list) – array [row,column] with row and column being int. The coordinates at which Game will place the player on change_level().
  • ui_borders (str) – To set all the borders to the same value
  • ui_border_left (str) – A string that represents the left border.
  • ui_border_right (str) – A string that represents the right border.
  • ui_border_top (str) – A string that represents the top border.
  • ui_border_bottom (str) – A string that represents the bottom border.
  • ui_board_void_cell (str) – A string that represents an empty cell. This option is going to be the model of the BoardItemVoid (see pygamelib.board_items.BoardItemVoid)
  • parent (Game) – The parent object (usually the Game object).
  • DISPLAY_SIZE_WARNINGS (bool) – A boolean to show or hide the warning about boards bigger than 80 rows and columns.
__init__(**kwargs)

Initialize self. See help(type(self)) for accurate signature.

Methods

__init__(**kwargs) Initialize self.
check_sanity() Check the board sanity.
clear_cell(row, column) Clear cell (row, column)
display() Display the entire board.
display_around(item, row_radius, column_radius) Display only a part of the board.
generate_void_cell() This method return a void cell.
get_immovables(**kwargs) Return a list of all the Immovable objects in the Board.
get_movables(**kwargs) Return a list of all the Movable objects in the Board.
height A convenience read only property to get the height of the Board.
init_board() Initialize the board with BoardItemVoid that uses ui_board_void_cell as model.
init_cell(row, column) Initialize a specific cell of the board with BoardItemVoid that uses ui_board_void_cell as model.
item(row, column) Return the item at the row, column position if within board’s boundaries.
move(item, direction[, step]) Board.move() is a routing function.
place_item(item, row, column) Place an item at coordinates row and column.
width A convenience read only property to get the width of the Board.