|
pygame.init()
Initialise all imported pygame modules.
pygame.quit()
Uninitialise all pygame modules.
|
Access online documentation |
|
Sprite()
The base class for all the sprites of your game.
Group()
A container class to hold multiple Sprite objects.
spritecollide()
List all the sprites in a group that collide with a specified sprite.
groupcollide()
Find all sprites that collide between two groups.
collide_mask()
Check if two sprites are colliding (using mask/transparency).
|
Access online documentation |
|
alive
Does this sprite belong to any group? (Boolean value)
groups
A list of all the groups that contain this sprite.
update()
A method that can be overridden (in a derived class) to implement the behaviour of a sprite.
add()
Add this sprite to the specified group(s).
remove()
Remove this sprite from the specified group(s).
kill()
Remove the sprite from all groups. |
Access online documentation |
|
sprites
A list of all the sprites contained by this group
add()
Add the specified sprite(s) to this group.
remove()
Remove the specified sprite(s) from this group.
has()
Check if specified sprite(s) are in this group.
update()
Call the update() method on all the sprites from this group.
draw()
Blit all the sprites images,
clear()
Draw the specified background over the sprites from this group.
empty()
Remove all sprites from this group. |
Access online documentation |
|
init()
Initialise the display module.
quit()
uninitialise the display module.
set_mode()
Initialise a window or a screen for display using the specified size. This function returns a Surface object.
get_surface()
Get a reference to the currently set display surface.
flip()
Update the full display Surface to the screen.
update()
Update portions of the screen for software displays.
set_icon()
Change the system image for the display window.
set_caption()
Set the current window caption.
get_caption()
Get the current window caption.
get_window_size()
Return the size of the window or screen as a tuple: (width, height). |
Access online documentation |
|
line()
Draw a line on the specified surface.
rect()
Draw a rectangle on the specified surface.
polygon()
Draw a polygon on the specified surface.
circle()
Draw a circle on the specified surface.
ellipse()
Draw an ellipse on the specified surface.
|
Access online documentation |
|
flip()
Flip the specified horizontally and/or vertically.
scale()
Resize the specified surface to a new resolution (width,height).
rotate()
Rotate a specified surface using a specified angle (in degrees). |
Access online documentation |
|
blit()
Draw a specified image/surface on this surface.
convert()
Change the pixel format of this surface/image.
convert_alpha()
Change the pixel format of this surface/image including per pixel alphas to support opacity/transparency.
fill()
Fill this surface with a solid color
set_colorkey()
Set the transparent colorkey.
set_alpha()
Set the alpha value for the full Surface image. (To allow transparency)
get_width()
Get the width of this surface.
get_height()
Get the height of this surface.
get_rect()
Returns the rectangular area (Rect object) of this Surface.
get_at()
Set the colour value for a single pixel identified using its (x,y) coordinates. |
Access online documentation |
|
x,y
Used to set or retrieve the x and y coordinates of the rectangle object. Other properties can also be used such as top, left, bottom, right, topleft, bottomleft, topright, bottomright, midtop, midleft, midbottom, midright, center, centerx, centery.
width
Used to set or retrieve the width coordinates of the rectangle object.
height
Used to set or retrieve the height coordinates of the rectangle object.
copy()
Create a copy the rectangle object.
move()
Move a copy the rectangle object to the specified (x,y) coordinates.
inflate()
Grow or shrink the rectangle size.
collidepoint()
Check if a point (identified using (x,y) coordinates) is inside a rectangle.
colliderect()
Check if this rectangle object overlaps with another specified rectangle object.
collidelist()
Check if this rectangle object overlaps with any other specified rectangle objects. |
Access online documentation |
|
render()
Add text on a new surface.
set_underline()
To underline the text!
set_bold()
To render the text in bold!
set_italic()
To render the text in italic!
|
Access online documentation |
|
wait()
Pause the program for a specified amount of milliseconds.
delay()
Pause the program for a specified amount of milliseconds.
get_ticks()
Return the number of milliseconds since pygame.init() was called.
set_timer()
Set an event type to appear on the event queue every given number of milliseconds.
Clock()
Create a clock object to help track time and set the desired frame rate.
|
Access online documentation |
|
tick()
Update the clock. Should be used once per frame.
get_time()
Return the number of milliseconds that passed between the previous two calls to Clock.tick().
get_fps()
Compute your game’s framerate (in frames per second) by averaging the last ten calls to Clock.tick(). |
Access online documentation |
|
Event()
Instantiate a new event object.
get()
Get (and remove) all the events from the queue. Type(s) of events to be retrieved can be specified.
wait()
Wait for a single event from the queue. The event will be returned and removed from the queue. While the program is waiting it will sleep in an idle state.
clear()
Remove all events from the queue. Type(s) of events to be removed can be specified. |
Access online documentation |
|
type
The type of event such as QUIT, KEYDOWN, KEYUP, MOUSEMOTION, MOUSEBUTTONDOWN, MOUSEBUTTONUP, etc.
key
To find out which key has been pressed.
pos
To find out the position of the mouse cursor using (x,y) coordinates.
|
Access online documentation |
|
get_pressed()
Returns a list of Boolean values representing the state of all the mouse buttons.
get_pos()
Returns the position of the mouse cursor, using (x,y) coordinates.
set_pos()
Sets the position of the mouse cursor, using (x,y) coordinates.
set_visible()
Hide or show the mouse cursor.
set_cursor()
Change the image for the mouse cursor. |
Access online documentation |
|
get_pressed()
Returns a list of Boolean values representing the state of all the keyboard keys.
get_mods()
Used to determine which modifier key(s) are being held.
name()
Returns the name (string value) of a key identifier.
|
Access online documentation |
|
load()
Load a music file for playback.
unload()
Unload the currently loaded music to free up resources.
play()
Start the playback of the music stream.
rewind()
Reset the playback of the current music to the beginning.
pause()
Temporarily stop music playback.
unpause()
Resume the previously paused playback.
fadeout()
Stop music playback with a fading out effect over a specified number of milliseconds.
stop()
Stop the music playback.
get_volume()
Set the music volume to a value between 0.0 and 1.0.
set_volume()
Return the current volume for the music. The value will be between 0.0 and 1.0.
queue()
Queue a sound file to follow the current. Only one sound file can be queued at a time. |
Access online documentation |
|
pre_init()
Preset the mixer init arguments
init()
Initialise the mixer module.
pause()
Temporarily stop playback of all sound channels.
unpause()
Resume paused playback of sound channels.
fadeout()
Fade out the volume on all sounds before stopping.
stop()
Stop playback of all sound channels.
quit()
Uninitialise the mixer.
Sound()
Create a new Sound object from a file or buffer object. |
Access online documentation |
|
play()
Begin sound playback.
stop()
Stop sound playback.
fadeout()
Stop sound playback after fading out.
set_volume()
Set the playback volume for this Sound using a value between 0.0 and 1.0.
get_volume()
Get the playback volume for this Sound using a value between 0.0 and 1.0.
get_length()
Get the length in seconds of this Sound. |
Access online documentation |