diff --git a/dzien_01/d_04_pong.py b/dzien_01/d_04_pong.py new file mode 100644 index 0000000..ab0c889 --- /dev/null +++ b/dzien_01/d_04_pong.py @@ -0,0 +1,38 @@ +import pgzrun +# Start programu +WIDTH = 1000 +HEIGHT = 676 +TITLE = "PONG - najlepsza gra na świecie ;-)" + +# definicja sprita +sprite = Actor("ball.png") +ship = Actor("ship.png") +sprite.x = WIDTH//2 +sprite.y = HEIGHT//2 + +# Najważniejsze funkcje sterujące +def update(): + if keyboard.d: + sprite.x += 5 + if keyboard.a: + sprite.x -= 5 + if keyboard.w: + sprite.y -= 5 + if keyboard.s: + sprite.y += 5 + + if sprite.y > HEIGHT: + sprite.y = 0 + elif sprite.y < 0: + sprite.y = HEIGHT + elif sprite.x < 0: + sprite.x = WIDTH + elif sprite.x > WIDTH: + sprite.x = 0 + + +def draw(): + screen.blit("tomulus64.jpg", (0,0) ) + sprite.draw() + +pgzrun.go() \ No newline at end of file diff --git a/dzien_01/images/ship.png b/dzien_01/images/ship.png new file mode 100644 index 0000000..5904484 Binary files /dev/null and b/dzien_01/images/ship.png differ