jeudi 13 juin 2019

I have a problem with the If statement on text with def time

I am a beginner using python 37 and just can't def time correctly editing a pygame. I want to show some text if the score of a game > 100, and I know I can't use "print" instead on "text", because it shows on the program bar, not in the program itself (like I'd see)

I already tried to def time(score, text): and put only def time():

Like this:

import pygame
import time

def time():
time.sleep(5)
if score > 100:
text = "X"
label = myFont.render(text, 1, WHITE)
screen.blit(label, (WIDTH-100, HEIGHT-50))

import pygame
import time

def time(score, text):
time.sleep(5)
if score > 100:
text = "X"
label = myFont.render(text, 1, WHITE)
screen.blit(label, (WIDTH-100, HEIGHT-50))

Aucun commentaire:

Enregistrer un commentaire