Why the text message on screen is not updating and the print statement updates it? Here is the code:
font = pygame.font.SysFont('Comic Sans MS', 30)
textsurface = font.render(("You have lifes: " + str(lifes)), False, (0, 0, 0))
def check(lifes):
if poop.x == bullet.x and bullet.y > poop.y and bullet.y < poop.y + pheight:
lifes -= 1
print(lifes)
def moves(move):
if move[pygame.K_UP] and poop.y - vel > 0:
poop.y -= vel
if move[pygame.K_DOWN] and poop.y + vel + pheight < win_height:
poop.y += vel
bullet.x -= 5
def redraw_screen(white):
WIN.fill(white)
WIN.blit(poo, (poop.x, poop.y))
WIN.blit(bull, (bullet.x, bullet.y))
WIN.blit(textsurface, (20, 20))
pygame.display.update()
def main():
redraw_screen(blue)
move = pygame.key.get_pressed()
textsurface = font.render(str(lifes), False, (0, 0, 0))
moves(move)
check(lifes)