
import pygame
pygame.init()
display_width = 500
display_height = 350
gameDisplay = pygame.display.set_mode((display_width, display_height))
pygame.display.set_caption('Feliz Aniversário')
black = (0, 0, 0)
white = (255, 255, 255)
clock = pygame.time.Clock()
crashed = False
# Imagem retirada no google
bolo = pygame.image.load('anos.jpg')
def anos(x, y):
gameDisplay.blit(bolo, (x, y))
x = (display_width * 0.05)
y = (display_height * 0.1)
def text (x1,y1):
vermelho = (255,99,71)
azul = (135,206,235)
font = pygame.font.Font('freesansbold.ttf', 32)
text = font.render('Feliz Aniversário', True, vermelho, azul)
textRect = text.get_rect().center
# set the center of the rectangular object.
gameDisplay.blit(text, textRect)
x1=display_width / 2
y1=display_height / 2
while not crashed:
for event in pygame.event.get():
if event.type == pygame.QUIT:
crashed = True
gameDisplay.fill(white)
anos(x,y)
text(x1,y1)
pygame.display.update()
clock.tick(60)
pygame.quit()
quit()
Comentários
Enviar um comentário