pong - text

This commit is contained in:
2026-03-17 13:43:08 +01:00
parent cdff42f38f
commit 38c27e03fb

View File

@@ -13,13 +13,13 @@ 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():
def napis(odleglosc):
winner_txt = f"Odległość: {odleglosc} w pixelach"
screen.draw.text(
winner_txt, (WIDTH // 3, 20), color="red", fontsize=60
winner_txt, (5, 20), color="red", fontsize=60
)
# Najważniejsze funkcje sterujące
def update():
@@ -46,6 +46,7 @@ def draw():
screen.blit("tomulus64.jpg", (0,0) )
ship.draw()
sprite.draw()
napis()
odl = round(ship.distance_to(sprite), 1)
napis(odl)
pgzrun.go()