Creepy-simulation
 
Loading...
Searching...
No Matches
view.block.Block Class Reference

Public Member Functions

 __init__ (self, x, y, size)
 
 draw (self, screen, image, zoom_level, offset_x, offset_y)
 
 contains (self, x, y)
 
 get_borders (self, offset)
 

Public Attributes

 x
 
 y
 
 size
 

Detailed Description

@class Block
@brief Represents a block with a position and size.

The Block class provides methods for rendering the block on the screen,
determining if a point is within the block, and calculating its borders.

Constructor & Destructor Documentation

◆ __init__()

view.block.Block.__init__ (   self,
  x,
  y,
  size 
)
Initializes a Block object.

@param x: The x-coordinate of the block.
@param y: The y-coordinate of the block.
@param size: The size of the block (width and height assumed equal).

Member Function Documentation

◆ contains()

view.block.Block.contains (   self,
  x,
  y 
)
Checks if the given point is within the block.

@param x: The x-coordinate of the point.
@param y: The y-coordinate of the point.
@return: True if the point is within the block, otherwise False.

◆ draw()

view.block.Block.draw (   self,
  screen,
  image,
  zoom_level,
  offset_x,
  offset_y 
)
Draws the block on the screen using the specified image.

@param screen: The pygame surface to draw on.
@param image: The image to use for rendering the block.
@param zoom_level: The current zoom level for scaling the block.
@param offset_x: The horizontal offset for positioning the block.
@param offset_y: The vertical offset for positioning the block.

◆ get_borders()

view.block.Block.get_borders (   self,
  offset 
)
Calculates the borders of the block, adjusted by the given offset.

@param offset: A tuple (offset_x, offset_y) to adjust the borders.
@return: A tuple containing the top-left and bottom-right coordinates of the block.

Member Data Documentation

◆ size

view.block.Block.size

◆ x

view.block.Block.x

◆ y

view.block.Block.y

The documentation for this class was generated from the following file: