Release: 16/10/2001

The sprites.py program uses the Picture and ClickPicture classes from the appobjects module to display sprites. Examples of this are:

# This picture allows actions to be assigned to mouse buttons
libs = ClickPicture(x, -480, x, -480, sprites, '!libraries')

def exit_fn(args):

	global quit

	quit = 1

# Set an action
libs.add_clickaction(app._select_, exit_fn, ['libs'])

Having loaded some sprites, one is positioned and given zero width and height. Instances of the ClickPicture class, like those of the Picture class from which it is derived, will expand the upper right corner of their bounding boxes to allow the whole image to be displayed.

# Two sprites with the same size, but from different modes
lost1 = Picture(256, -256, 256, -256, sprites, '!lost1')
lost2 = Picture(256, -256 - sprites.sprites['!lost1']['height'],
		256, -256 - sprites.sprites['!lost1']['height'],
		sprites, '!lost2')

The sprites are identically sized, but have different resolutions. In addition, the first one has a palette whereas the second does not. The Picture class uses the sprite area object to correctly render the sprites despite their internal differences.

David Boddie