A Pygame framework that facilitates the creation and development of projects https://shampoo.ooo
Go to file
Cocktail Frank ca3a023f6b Replace deprecated ConfigParser.readfp with ConfigParser.read_file 2024-10-16 14:22:31 -04:00
pgfw Replace deprecated ConfigParser.readfp with ConfigParser.read_file 2024-10-16 14:22:31 -04:00
.gitignore old print formatted 2012-12-23 19:20:36 +09:00
LICENSE.txt updated readme and license, fixed crash on non existing default asset folders 2022-10-24 21:47:25 -04:00
MANIFEST.in added distutils setup script 2012-08-25 00:05:25 -04:00
README.md fix repo url 2023-04-28 15:26:55 -04:00
__init__.py video recorder request; points; apply motion overflow 2015-03-26 13:48:36 -04:00
sample.py sound effect 2018-05-21 19:46:28 -04:00
setup.py added distutils setup script 2012-08-25 00:05:25 -04:00

README.md

Pygame Framework

PGFW is a game framework that facilitates the creation and development of Pygame projects. It contains a class Game which can be inherited and used as a project skeleton. There are classes for features such as sprites, animations, audio, b-splines, geometry, and screen capture. It is a collection of code used in previous projects with a focus on creating 2D games. Some examples of games using it are Picture Processing, Scrapeboard, and Cakefoot.

Requirements

Start a project

Clone the repository (or download and unzip it)

git clone https://open.shampoo.ooo/shampoo/pgfw

Save the following script at the root of the repository to create a project that redraws a square at a random location every second. The project can be run with python3 [SCRIPT]. Maybe some cats may even like this game. This script is also available in sample.py.

from time import sleep
from random import randint

from pgfw.Game import Game

class SampleGame(Game):

    square_width = 30

    # instructions in the update method automatically run once every frame
    def update(self):
        sleep(1)
        screen = self.get_screen()
        bounds = screen.get_size()
        screen.fill((0, 0, 0))
        screen.fill((255, 255, 255),
                    (randint(0, bounds[0]), randint(0, bounds[1]),
                     self.square_width, self.square_width))


if __name__ == '__main__':
    SampleGame().run()

To further build this example, the Pygame API and classes in pgfw/ could be imported and used directly in the update function.

License

Unrestricted use, under the zlib license, see LICENSE.txt

Pygame powered