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
Release history Release notifications | RSS feed
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 hashes)
Built Distribution
Close
Hashes for pygame_pause-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b84dc5f07ca7486ca81e511bcc8bb9898e8793c92cafc60c57e4e5b093d222ae |
|
MD5 | ee73fdec307c6b9202e24bdc0e556883 |
|
BLAKE2b-256 | c292b509188156e56c3c7b2b7be252de43b289471fe835d0cf368aa611a140e6 |