kids encyclopedia robot

Pygame facts for kids

Kids Encyclopedia Facts
Quick facts for kids
Pygame
Pygame logo.svg
Original author(s) Lenard Lindstrom, René Dudfield, Pete Shinners, Nicholas Dudfield, Thomas Kluyver, and others
Developer(s) Pygame Community
Initial release 28 October 2000; 25 years ago (2000-10-28)
Stable release
2.6.1 / 30 September 2024; 12 months ago (2024-09-30)
Written in Python, C, Cython, and Assembly
Operating system Cross-platform
Type API
License GNU Lesser General Public License

Pygame is a special collection of tools for making video games. It uses the Python programming language. This set of tools helps you add cool computer graphics and sounds to your games. Pygame works on many different types of computers and devices.

Pygame's Story: How It Started

Pygame was first created by a person named Pete Shinners. He started it because another similar project had stopped being updated. Since the year 2000, Pygame has been a project built by a group of people working together. It's free for everyone to use. You can even use it to make games you want to sell! This is possible because of its special license, which allows both free and commercial use.

Pygame 2: A Big Update

A new version of Pygame, called "Pygame Reloaded," was first thought about in 2009. However, work on Pygame slowed down for a few years. Development picked up again around the end of 2016. After version 1.9.5 came out in March 2019, the team actively worked on the new Pygame 2.0. Pygame 2.0 was officially released on October 28, 2020. This was a special day because it was Pygame's 20th birthday!

What Pygame Can Do: Cool Features

Pygame uses a powerful tool called Simple DirectMedia Layer (SDL). This helps game developers create real-time games. It lets them focus on the game's fun parts, not on super-complicated computer code. Pygame makes it easier to build games using a simpler language like Python. This is because the hardest parts of game creation are handled by SDL.

More Pygame Abilities

Pygame also has many other useful features. It can help with math for moving objects. It can find out if two objects in your game crash into each other. Pygame helps manage 2D characters and objects in your game scenes. It even supports MIDI music files. You can also use it for camera effects, changing individual pixels, and making cool text with different fonts.

Pygame on Phones

You can even make games with Pygame that run on Android phones and tablets! This is done using a special tool called Pygame Subset for Android (pgs4a). On Android, Pygame supports sounds, vibrations, keyboards, and even the phone's motion sensor.

The Pygame Community

Pygame has a strong community of users and developers. Sometimes, different groups within the community work on slightly different versions. For example, there is a version called pygame-ce, which stands for Community Edition.

PyWeek: A Game-Making Challenge

There's a fun competition called PyWeek. In PyWeek, people try to create new games using Python. Most of the time, they use Pygame for their games. The Pygame community has also made many helpful guides and lessons for new users.

Example Code: Making a Raccoon Bounce

Here is a simple example of Pygame code. This code makes an image of a raccoon bounce around the screen. It flips the raccoon when it hits the side.

import pygame, sys
pygame.init()
screen = pygame.display.set_mode((1280, 720))
clock = pygame.time.Clock()
clock.tick(30)
black = 0, 0, 0
raccoon = pygame.image.load("raccoon.png")
raccoon = pygame.transform.scale(raccoon, (200, 140))
raccoonrect = raccoon.get_rect()
velocity = [1,1]

while True:
        raccoonrect = raccoonrect.move(velocity)
        if raccoonrect.left < 0 or raccoonrect.right > 1280:
                velocity[0] = -velocity[0]
                raccoon = pygame.transform.flip(raccoon,True,False)
        if raccoonrect.top < 0 or raccoonrect.bottom > 720:
                velocity[1] = -velocity[1]
        for event in pygame.event.get():
                if event.type == pygame.QUIT: sys.exit()
    #screen update    
        screen.fill(black)
        screen.blit(raccoon, raccoonrect)
        pygame.display.flip()

Games Made with Pygame

Many games have been created using Pygame. Here are a couple of well-known examples:

  • Frets on Fire
  • Dangerous High School Girls in Trouble!

See also

Kids robot.svg In Spanish: Pygame para niños

  • Cocos2d
  • Panda3D
  • Pyglet
kids search engine
Pygame Facts for Kids. Kiddle Encyclopedia.