core.components.screen module

core.components.screen.blit_alpha(target, source, location, opacity)[source]

Blits a surface with alpha that can also have it’s overall transparency modified Taken from http://nerdparadise.com/tech/python/pygame/blitopacity/

Parameters:
  • target (pygame.Surface) – The target surface to blit the image to. This is usually the screen or some other subsurface.
  • source (pygame.Surface) – The source surface that you wish to blit with transparency.
  • location (Tuple) – A tuple of the coordinates where you wish to blit the image.
  • opacity (Integer) – The transparency level you wish the overall image to have.
Return type:

None

Returns:

None

core.components.screen.center_map(tile_size, map_size, resolution)[source]

Centers the map and resets the panning limit

Parameters:
  • tile_size (List) – The map tile size in pixels as a list of [x,y] pixels.
  • map_size (List) – The map size in number of tiles as a list of [x,y] tiles.
  • resolution (List) – The resolution as a list of [x,y] in pixels.
Return type:

Tuple

Returns:

A tuple with the (limit_x, limit_y, global_x, global_y)

core.components.screen.mouse_pan_down(mouse_pos, pan_margin, global_y, pps, time_passed_seconds, resolution, limit_y)[source]

Pans the screen down by subtracting from the global_y variable based on if the mouse position is within the specified pan margin

Parameters:
  • mouse_pos (Tuple) – The current mouse position in tuple format (e.g. (25, 40) )
  • pan_margin (Integer) – Value in pixels of margin of the screen that the mouse must be within in order to start panning
  • global_y (Integer) – The main global_y variable used to modify the coordinates of all panable objects
  • pps (Integer) – The paning rate specified in pixels per second
  • time_passed_seconds (Float) – The amount of time passed in seconds between this frame and the last frame
  • limit_y (Integer) – [optional] limit_y value that prevents panning over this specified limit
Return type:

Integer

Returns:

The modified global_y variable

core.components.screen.mouse_pan_left(mouse_pos, pan_margin, global_x, pps, time_passed_seconds, limit_x=0)[source]

Pans the screen left by adding to the global_x variable based on if the mouse position is within the specified pan margin

Parameters:
  • mouse_pos (Tuple) – The current mouse position in tuple format (e.g. (25, 40) )
  • pan_margin (Integer) – Value in pixels of margin of the screen that the mouse must be within in order to start panning
  • global_x (Integer) – The main global_x variable used to modify the coordinates of all panable objects
  • pps (Integer) – The paning rate specified in pixels per second
  • time_passed_seconds (Float) – The amount of time passed in seconds between this frame and the last frame
  • limit_x (Integer) – [optional] limit_x value that prevents panning over this specified limit
Return type:

Integer

Returns:

The modified global_x variable

core.components.screen.mouse_pan_right(mouse_pos, pan_margin, global_x, pps, time_passed_seconds, resolution, limit_x)[source]

Pans the screen right by subtracting from the global_x variable based on if the mouse position is within the specified pan margin

Parameters:
  • mouse_pos (Tuple) – The current mouse position in tuple format (e.g. (25, 40) )
  • pan_margin (Integer) – Value in pixels of margin of the screen that the mouse must be within in order to start panning
  • global_x (Integer) – The main global_x variable used to modify the coordinates of all panable objects
  • pps (Integer) – The paning rate specified in pixels per second
  • time_passed_seconds (Float) – The amount of time passed in seconds between this frame and the last frame
  • limit_x (Integer) – [optional] limit_x value that prevents panning over this specified limit
Return type:

Integer

Returns:

The modified global_x variable

core.components.screen.mouse_pan_up(mouse_pos, pan_margin, global_y, pps, time_passed_seconds, limit_y=0)[source]

Pans the screen up by adding to the global_y variable based on if the mouse position is within the specified pan margin

Parameters:
  • mouse_pos (Tuple) – The current mouse position in tuple format (e.g. (25, 40) )
  • pan_margin (Integer) – Value in pixels of margin of the screen that the mouse must be within in order to start panning
  • global_y (Integer) – The main global_y variable used to modify the coordinates of all panable objects
  • pps (Integer) – The paning rate specified in pixels per second
  • time_passed_seconds (Float) – The amount of time passed in seconds between this frame and the last frame
  • limit_y (Integer) – [optional] limit_y value that prevents panning over this specified limit
Return type:

Integer

Returns:

The modified global_y variable

core.components.screen.pan_down(global_y, pps, time_passed_seconds, limit_y)[source]

Pans the screen down by subtracting from the global_y variable

Parameters:
  • global_y (Integer) – The main global_y variable used to modify the coordinates of all panable objects
  • pps (Integer) – The paning rate specified in pixels per second
  • time_passed_seconds (Float) – The amount of time passed in seconds between this frame and the last frame
  • limit_y (Integer) – [optional] limit_y value that prevents panning over this specified limit
Return type:

Integer

Returns:

The modified global_y variable

core.components.screen.pan_left(global_x, pps, time_passed_seconds, limit_x=0)[source]

Pans the screen to the left by adding to the global_x variable

Parameters:
  • global_x (Integer) – – The main global_x variable used to modify the coordinates of all panable objects
  • pps (Integer) – – The paning rate specified in pixels per second
  • time_passed_seconds (Float) – – The amount of time passed in seconds between this frame and the last frame
  • limit_x (Integer) – [optional] Optional limit_x value that prevents panning over this specified limit
Return type:

Integer

Returns:

The modified global_x variable

core.components.screen.pan_right(global_x, pps, time_passed_seconds, limit_x)[source]

Pans the screen to the right by subtracting from the global_x variable

Parameters:
  • global_x (Integer) – – The main global_x variable used to modify the coordinates of all panable objects
  • pps (Integer) – – The paning rate specified in pixels per second
  • time_passed_seconds (Float) – – The amount of time passed in seconds between this frame and the last frame
  • limit_x (Integer) – [optional] Optional limit_x value that prevents panning over this specified limit
Return type:

Integer

Returns:

The modified global_x variable

core.components.screen.pan_up(global_y, pps, time_passed_seconds, limit_y=0)[source]

Pans the screen up by adding to the global_y variable

Parameters:
  • global_y (Integer) – The main global_y variable used to modify the coordinates of all panable objects
  • pps (Integer) – The paning rate specified in pixels per second
  • time_passed_seconds (Float) – The amount of time passed in seconds between this frame and the last frame
  • limit_y (Integer) – [optional] limit_y value that prevents panning over this specified limit
Return type:

Integer

Returns:

The modified global_y variable