/* jquery */ /* jquery accordion style*/ /* jquery init */

Raspberry Pi PyGame Module Introduction

The last of my Learn Python on the Raspberry Pi series, in issue 1225, has an introduction the PyGame module.

The article builds on previous lessons including loops, condition statements, function definitions and event handling. The end result is a fully explained program structure that can form the basis of more advanced PyGame programs.

If you don't have a Raspberry Pi you can still follow the series with these emulation instructions.

Here are a few extracts from Part 6:

Trying your hand at game programming is an excellent way of honing existing expertise and gaining new skills. Unfortunately, creating even a simple game with the Python language and its Standard Library requires significant levels of programming experience.

However, and not for the first time, Python's extensive collection of modules comes to the rescue. The PyGame module is designed to ease the path to game creation with a rich set of highly specialised functionality.

A complete game will typically involve graphics, animation, collision detection, sound effects, music tracks, scoring and handling user input events. Quite a challenge. The PyGame module is nevertheless more than capable of meeting this challenge.

PyGame can draw lines, shapes and surfaces; write text in a large range of fonts and styles; load, manipulate and move images; play sounds, music tracks and videos; consume keyboard, mouse and joystick input events; interact with files, CDROM disks and cameras; and much more. To see a list of PyGame module functionality visit pygame.org/docs/ref.

A major reason for choosing Python as the default Raspberry Pi programming language, is the huge collection of programming resources, tips, videos and code examples that are available. The PyGame module is no exception.

The pygame.org website has masses of information and assistance for the keen PyGame coder to explore, including documents, tutorials and screenshots. In particular there's an extensive collection of examples at pygame.org/docs/ref/examples. If you prefer a visual approach to learning, a quick search on YouTube will uncover plenty of video tutorials and guides.

Visit my Raspberry Pi page for news, reviews, advice and tutorials.

No comments: