pong - text
This commit is contained in:
@@ -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()
|
||||
Reference in New Issue
Block a user