Skip to main content

Tiny helper toolkit for building simple games.

Project description

# DiamondGameKit

DiamondGameKit is a tiny helper toolkit for building simple Pygame-based games.

It provides lightweight building blocks so you can focus on gameplay instead of boilerplate.

## Features

- Game wrapper (screen + clock + FPS)

- Player rectangle entity

- Enemy spawner with downward movement

- Simple keyboard input helpers

- Score HUD

- Internal plugin system

## Installation

pip install diamondgamekit

## Quick Example

import pygame

import diamondgamekit as dgk



pygame.init()

screen = pygame.display.set\_mode((800, 600))

clock = pygame.time.Clock()



game = dgk.Game(screen, clock, title="Dodge The Blocks")



player = dgk.PlayerRect(x=400, y=550, w=40, h=40, speed=5)

spawner = dgk.EnemySpawnerRect(

    width=40, height=40,

    spawn\_y\_range=(-600, -40),

    count=10,

    speed=5,

    screen\_width=800,

)

score = dgk.Score(font\_size=32, color=(255, 255, 255))



running = True

while running:

    for event in pygame.event.get():

        if event.type == pygame.QUIT:

            running = False



    keys = pygame.key.get\_pressed()

    dgk.handle\_basic\_horizontal\_input(

        player,

        keys,

        left=pygame.K\_a,

        right=pygame.K\_d,

        bounds=(0, 800 - player.rect.width),

    )



    spawner.update\_all()

    for e in spawner.enemies:

        if e.y > 600:

            spawner.reset\_enemy(e)

            score.add(1)

        if player.rect.colliderect(e):

            running = False



    screen.fill((20, 20, 20))

    pygame.draw.rect(screen, (0, 255, 0), player.rect)

    for e in spawner.enemies:

        pygame.draw.rect(screen, (255, 0, 0), e)



    score.draw(screen, x=10, y=10)

    pygame.display.flip()

    game.tick(60)



pygame.quit()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

diamondgamekit-1.0.0.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

diamondgamekit-1.0.0-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file diamondgamekit-1.0.0.tar.gz.

File metadata

  • Download URL: diamondgamekit-1.0.0.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.14

File hashes

Hashes for diamondgamekit-1.0.0.tar.gz
Algorithm Hash digest
SHA256 bb74601a7cb562640b3760ff80b93c7bb2249423e9f14a3f5391e1d4753ecc15
MD5 6be11a39365a97198485eb7fb570b831
BLAKE2b-256 5da575e1e1dd0907e0f2adb3f2c0761b027095d3c8ef5bca2934b89f1fa9a041

See more details on using hashes here.

File details

Details for the file diamondgamekit-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: diamondgamekit-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 6.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.14

File hashes

Hashes for diamondgamekit-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ca6a09ee57ebd0accb2f188b1b4b3bcb718e52d3f702efe4fe2195140194be25
MD5 7b3a85fc064d81cd13051327cda8fc23
BLAKE2b-256 b2786a104d384d4cb0892a133a4049070514c4742fad440fa3c3d40cfb035a44

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page