pong - text
This commit is contained in:
@@ -13,7 +13,14 @@ sprite.x = WIDTH//2
|
|||||||
sprite.y = HEIGHT//2
|
sprite.y = HEIGHT//2
|
||||||
ship.x = randint(20,WIDTH-20)
|
ship.x = randint(20,WIDTH-20)
|
||||||
ship.y = randint(20,HEIGHT-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
|
# Najważniejsze funkcje sterujące
|
||||||
def update():
|
def update():
|
||||||
if keyboard.d:
|
if keyboard.d:
|
||||||
@@ -39,5 +46,6 @@ def draw():
|
|||||||
screen.blit("tomulus64.jpg", (0,0) )
|
screen.blit("tomulus64.jpg", (0,0) )
|
||||||
ship.draw()
|
ship.draw()
|
||||||
sprite.draw()
|
sprite.draw()
|
||||||
|
napis()
|
||||||
|
|
||||||
pgzrun.go()
|
pgzrun.go()
|
||||||
Reference in New Issue
Block a user