diff --git a/dzien_01/d_04_pong.py b/dzien_01/d_04_pong.py index 0751e5b..e665bd9 100644 --- a/dzien_01/d_04_pong.py +++ b/dzien_01/d_04_pong.py @@ -13,7 +13,14 @@ sprite.x = WIDTH//2 sprite.y = HEIGHT//2 ship.x = randint(20,WIDTH-20) ship.y = randint(20,HEIGHT-20) +odleglosc = ship.distance_to(sprite) + +def napis(): + winner_txt = f"Odległość: {odleglosc} w pixelach" + screen.draw.text( + winner_txt, (WIDTH // 3, HEIGHT // 2), color="red", fontsize=60 + ) # Najważniejsze funkcje sterujące def update(): if keyboard.d: @@ -39,5 +46,6 @@ def draw(): screen.blit("tomulus64.jpg", (0,0) ) ship.draw() sprite.draw() + napis() pgzrun.go() \ No newline at end of file