Return a rect that is the area for a dialog box on the screen

Returns:, required=0, exit=True)[source]

Checks to see if a given list has the required number of items, colorkey=(255, 0, 255))[source]

Convert image with perpixel alpha to normal surface with colorkey

This is a crude hack that only works well with images that do not have alpha blended antialiased edges. Using this function on such images will result in discoloration of edges.

  • surface (pygame.Surface) – Some image to change
  • colorkey (Sequence or pygame.Color) – Colorkey to use for transparency

Modified surface

Return type:


Take a valid image and create a mouse cursor., point, size)[source]

Find the cell of size, within rect, that point occupies.[source]

Load an image and scale it according to game settings

  • Filename will be transformed to be loaded from game resource folder
  • Will be converted if needed.
  • Scale factor will match game setting.
Return type:pygame.Surface[source]

Load image from the resources folder

  • Filename will be transformed to be loaded from game resource folder
  • Will be converted if needed.

This is a “smart” loader, and will convert files in the best way, but is slightly slower than just loading. Its important that this is not called too often (like once per draw!)

Parameters:filename – String
Return type:pygame.Surface[source]

Load a sound from disk

The required path will be appended to the filename

Parameters:filename (basestring) – filename to load
Return type:core.platform.mixer.Sound, **rect_kwargs)[source]

Load an image from disk and return a pygame sprite

Image name will be transformed and converted Rect attribute will be set

Any keyword arguments will be passed to the get_rect method of the image for positioning the rect.

Parameters:filename – Filename to load
Return type:core.components.sprite.Sprite*args, **kwargs)[source]

Create a new rect and scale it

  • args – Normal args for a Rect
  • kwargs – Normal kwargs for a Rect
Return type:

pygame.rect.Rect, text)[source]

Open a dialog with the standard window size

  • game
  • text – list of strings

Scale the thing

Parameters:number – int
Return type:int, factor=5)[source]

Scale a rect. Returns a new object.

  • rect – pygame Rect
  • factor – int
Return type:


Scale the thing

Return type:list, ratio)[source]

Scale a sprite’s image in place

Parameters:ratio – amount to scale by
Return type:core.components.sprite.Sprite, factor)[source]

Scale a surface. Just a shortcut.

Returns:Scaled surface
Return type:pygame.Surface, tile_size)[source]

Scales a map tile based on resolution.

Return type:pygame.Surface[source]

Given an unconverted file, determine if it has transparent pixels and return a converted image, with per-pixel alpha if needed.

Parameters:image – pygame.Surface
Return type:pygame.Surface, coords, size)[source]

Strip specific coordinates from a sprite sheet., start, size, columns, rows=1)[source]

Strips individual frames from a sprite sheet given a start location, sprite size, and number of columns and rows.[source]

Appends the resource folder name to a filename

Parameters:filename – String
Return type:basestring