Skip to content

display.items_frame documentation

kzkaktus edited this page Apr 26, 2021 · 1 revision

BlocksPane.ItemArea

BlocksPane inner class representing area in which block is displayed and might interact with Pygame events.

Properties

  • pos - position on which object displayed screen
  • side_length - side length of displayed block's texture
  • block - blocks that is displayed by object

ItemArea(pos, side_length, block):

Sets all properties to values of arguments of their name.

handle_click(pos):

Handles left mouse button click on given position pos from screen. If it overlaps with displayed object, returns the object. Otherwise returns None.

self_draw(screen):

Displays wrapped block on screen on position equal to current pos property value.


BlocksPane

Class representing side pane with all blocks available for placing on board by player.

Properties

  • board - game board, on which dragged blocks might be placed
  • blocks - list of blocks available to place on board, which are displayed on side pane
  • level_view - gameplay.levelView type object that blocks from blocks pane are transfered to while dragging.
  • item_areas - list of gameplay.items_frame.BlocksPane.ItemArea objects, used to display list of available blocks and interact with Pygame events.
  • inactive_index - index of element of blocks list to remember block, which is being dragged on a screen.
  • side_lenght - side length of each block displayed on blocks side pane.

BlocksPane(board, blocks, level_view)

Sets board, blocks and level_view properties to values of arguments of their name. Sets rest of properties to None.

self_draw(screen, items_frame, block_side_length)

Displays side pane with blocks available for dragging, where screen is main application frame and side pane should be displayed in items_frame, with each displayed blocks' side length of block_side_length.

handle_click(pos)

Handles left mouse button click with mouse pos position on screen.

notify_flowing_block_placed()

Method used to notify blocks pane, that dragged block was successfully placed on board.

return_block(block)

Adds block to list of blocks displayed on side pane. Given block should be one of blocks initially displayed by side blocks pane, and then placed on board and returned from it.

set_available_blocks(blocks)

Replaces available blocks' list with new list blocks.

Clone this wiki locally