Skip to main content

Simple Pygame plugin for small kids

Project description

simple pygame plugin for kids.

Template. Empty window

from pioneer_game import Window

window = Window(1300, 700)  # 1300x700 window
fps = 80

while True:  # main loop
    window.fill('black')

    window.update(fps)  # update 80 times per second

Drawing simple objects

from pioneer_game import Window, Rect, Circle

window = Window(1300, 700)
fps = 80

square = Rect(window, 10, 10, 200, 200, 'red')
rectangle = Rect(window, 700, 200, 150, 300, 'orange')

circle = Circle(window, 800, 100, 50, 'white')
bublik = Circle(window, 500, 500, 75, 'pink', 30)

while True:
    window.fill('black')

    square.draw()
    rectangle.draw()

    circle.draw()
    bublik.draw()

    square.x = square.x + 1

    window.update(fps)

Example. DVD screen

from pioneer_game import Window, Label

window = Window(1024, 768, 'DVD test')

dvd = Label(window, 10, 10, 'grey', 'DVD', font='Impact', size=70, italic=True)
state = Label(window, 10, 10, 'grey', 'state: IDLE', italic=True)

dx, dy = 3, 3

while True:
    window.fill('black')
    dvd.draw()
    state.draw()

    dvd.x += dx
    dvd.y += dy

    if dvd.left < window.left or dvd.right > window.right:
        dx *= -1
    if dvd.top < window.top or dvd.bottom > window.bottom:
        dy *= -1

    window.update(80)

Ping Pong Game

pong

from pioneer_game import Window, Circle, Rect, Label

window = Window(1024, 768)
fps = 20

pad1 = Rect(window, 50, 20, 20, 200, color='grey')
text1 = Label(window, 10, 10, text='0', color='darkgray', size=50)
score1 = 0

pad2 = Rect(window, 954, 20, 20, 200, color='pink')
text2 = Label(window, 700, 10, color='darkgray', size=50)
score2 = 0

ball = Circle(window, 100, 100, radius=10, color='grey')
ball_speed = 3

dx = ball_speed
dy = ball_speed

while True:
    window.fill('green')

    pad1.draw()
    text1.draw()

    pad2.draw()
    text2.draw()

    ball.draw()

    ball.x += dx
    ball.y += dy

    if ball.bottom > window.bottom:
        dy = -dy
    if ball.top < window.top:
        dy = -dy

    if ball.right > window.right:
        score2 = score2 + 1
    if ball.left < window.left:
        score2 = score2 + 1

    if window.get_key('w') and pad1.top > window.top:
        pad1.y -= 5
    if window.get_key('s') and pad1.bottom < window.bottom:
        pad1.y += 5

    if window.get_key('up'):
        pad2.x -= 5
    if window.get_key('down') and pad2.bottom < window.bottom:
        pad2.x += 5

    if ball.colliderect(pad1):
        dx = ball_speed
    if ball.colliderect(pad2):
        dx = -ball_speed

    window.update(fps)

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

pioneergame-0.0.6.tar.gz (175.8 kB view details)

Uploaded Source

Built Distribution

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

pioneergame-0.0.6-py3-none-any.whl (177.9 kB view details)

Uploaded Python 3

File details

Details for the file pioneergame-0.0.6.tar.gz.

File metadata

  • Download URL: pioneergame-0.0.6.tar.gz
  • Upload date:
  • Size: 175.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.2

File hashes

Hashes for pioneergame-0.0.6.tar.gz
Algorithm Hash digest
SHA256 1113ac4483aadd733ee0fa2cef39874d2af867dbaf9a09571e2e883edcec938e
MD5 69d499556a9cdd7c4d30c34528649a8f
BLAKE2b-256 c63ed5e1c5ea8c21d6e8c0a9745cd1b7672b623a55094cc35ea159bcdb57f046

See more details on using hashes here.

File details

Details for the file pioneergame-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: pioneergame-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 177.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.2

File hashes

Hashes for pioneergame-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 61a652b373b9ed22c666f27130817a38da5bfb39fd01cd505eb73b5399f2173b
MD5 94cfbd4d722c7da4888e084d1f1d3d2c
BLAKE2b-256 689bc06ce3e079a6d29d16b90fd68e0dca090b8cdcf2451010677d46a5dfcb5e

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