Tutorial by Examples

Pygame has a module, pygame.draw, that contains functions which can draw shapes directly to a Surface. FunctionDescriptionpygame.draw.rectdraw a rectangle shapepygame.draw.polygondraw a shape with any number of sidespygame.draw.circledraw a circle around a pointpygame.draw.ellipsedraw a round shape...
In pygame you usually use Surfaces to represent the appearance of objects, and Rectangles to represent their positions. A Surface is like a blank sheet of paper which contain colors or images. There are two ways to create a Surface: blank from scratch or by loading an image. Create a Surface To cr...
There are kinds 3 of transparency supported in pygame: colorkeys, Surface alphas, and per-pixel alphas. Colorkeys Makes a color fully transparent, or more accurately, making a color simply not be blit. If you have an image with a black rect inside you could set a colorkey to prevent the black colo...

Page 1 of 1