Download pygame documentation pdf
More information. Status In development Category Book Rating. You will get access to the following files: Dec 14, Nov 17, Nov 07, Pygame includes a higher level sprite module to help organize games. The sprite module includes several classes that help manage details found in almost all games types. The Sprite classes are a bit more advanced than the regular pygame modules, and need more understanding to be properly used. Pygame used the NumPy python module to allow efficient per pixel effects on images.
Using the surface arrays is an advanced feature that allows custom effects and filters. This also examines some of the simple effects from the pygame example, arraydemo. Pygame, as of 1. This tutorial covers those use cases. Navigation index modules next pygame v2. The import statement writes the pygame version and a link to the Pygame website to the console as a side effect :.
The Pygame import statement is always placed at the beginning of the program. It imports the pygame classes, methods and attributes into the current name space.
Now this new methods can be called via pygame. The function display. It returns a Surface object wich we assign to the variable screen. This variable will be one of the most used variables.
It represents the window we see:. You can now run this program and test it. At this moment it does very little. It opens a window and closes it immediately. The most essential part of any interactive application is the event loop. Reacting to events allows the user to interact with the application.
Events are the things that can happen in a program, such as a. Try to move the mouse, click a mouse button, or type something on the keyboard. Every action you do produces an event which will be printed on the console. This will look something like this:. As we are in an infite loop, it is impossible to quit this program from within the application. In order to quit the program, make the console the active window and type ctrl-C.
This will write the following message to the console:. In order to quit the application properly, from within the application, by using the window close button QUIT event , we modify the event loop. First we introduce the boolean variable running and set it to True. Within the event loop we check for the QUIT event. If it occurs, we set running to False :.
0コメント