Skip to main content

It game pause module

Project description

Installation

pip install pygame_pause

How to use it?

import pygame import sys import os """first just import the module""" from pygame_pause import pause

pygame.init() pygame.mixer.init() pygame.font.init() pygame.display.init() screen=pygame.display.set_mode((1500,800),pygame.RESIZABLE) pygame.display.set_caption('pause module example') clock=pygame.time.Clock() fps=60 def gameloop(): x=100 x_vol=0 y=200 y_vol=0

while True:
    mouse=pygame.mouse.get_pos()
    
    for event in pygame.event.get():
        if event.type==pygame.QUIT:
            pygame.quit()
        if event.type==pygame.KEYDOWN:
            if event.key==pygame.K_a:
                """second just call the module"""
                pause.pause(gameloop)
            if event.key==pygame.K_RIGHT:
                x_vol=10
            if event.key==pygame.K_LEFT:
                x_vol=-10
            if event.key==pygame.K_UP:
                y_vol=-10
            if event.key==pygame.K_DOWN:
                y_vol=10
        elif event.type==pygame.KEYUP:
            if event.key==pygame.K_RIGHT:
                x_vol=0
            if event.key==pygame.K_LEFT:
                x_vol=0
            if event.key==pygame.K_UP:
                y_vol=0
            if event.key==pygame.K_DOWN:
                y_vol=0



    x+=x_vol
    y+=y_vol

    screen.fill((255,255,255))
    mouse_rect=pygame.draw.rect(screen,(0,0,255),(x,y,100,50))
    clock.tick(fps)
    pygame.display.flip()

gameloop()

License

© 2023 KURBAN HUSSAIN

This repository is licensed under the MIT license. See LICENSE for details.

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

pygame_pause-1.0.0.tar.gz (3.0 kB view details)

Uploaded Source

Built Distribution

pygame_pause-1.0.0-py3-none-any.whl (3.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pygame_pause-1.0.0.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.3

File hashes

Hashes for pygame_pause-1.0.0.tar.gz
Algorithm Hash digest
SHA256 27e006c7045956de512021bf7713c9005ac4ccf8edf3ad6064ce12974f11f0d5
MD5 cd396cb25f4c6ff8feb0f895adf42bf3
BLAKE2b-256 51805e2edbfd6155ef81247e08f64c06f5c41071cf38e3f8439bd582e724e175

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pygame_pause-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b84dc5f07ca7486ca81e511bcc8bb9898e8793c92cafc60c57e4e5b093d222ae
MD5 ee73fdec307c6b9202e24bdc0e556883
BLAKE2b-256 c292b509188156e56c3c7b2b7be252de43b289471fe835d0cf368aa611a140e6

See more details on using hashes here.

Supported by

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