pong - text

This commit is contained in:
2026-03-17 13:36:16 +01:00
parent 3dedde8ae9
commit eb28601287

View File

@@ -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()