Tule in not callable??
chciałem wyświetlić jednocześnie 2 napisy, ale dostaje komunikat jak wyżej, nie rozumiem dlaczego, i co robie żle. Chodzi o to że 2 napis nie che się wypisać,
import pygame
import time
pygame.init()
disp_width = 800
disp_height = 600
player_width = 96
black = (0,0,0)
white = (255,255,255)
red = (255,0,0)
display = pygame.display.set_mode((disp_width,disp_height))
pygame.display.set_caption('A RaGe!')
clock = pygame.time.Clock()
gamerImg = pygame.image.load('data\\img\\pajac.png')
def gamer(x,y):
display.blit(gamerImg, (x,y))
def Game():
x = (disp_width *0.45)
y = (disp_height * 0.8)
end = False
while not end:
for event in pygame.event.get():
if event.type == pygame.QUIT:
end = True
pressed = pygame.key.get_pressed()
if pressed[pygame.K_SPACE]: end = True
if pressed[pygame.K_DOWN]: y += 5
if pressed[pygame.K_UP]: y -= 5
if pressed[pygame.K_LEFT]: x -= 5
if pressed[pygame.K_RIGHT]: x += 5
if x > disp_width - player_width or x < 0: suicide()
display.fill(white)
gamer(x,y)
pygame.display.update()
clock.tick(60)
def suicide():
message_display('You have done with yourself')
message_display('Good',-1)
def message_display(text, var=0):
text_rage = pygame.font.Font('data\\fonts\\Unchained-RegularShadow.ttf',40)
TextSurf, TextRect = text_objects(text, text_rage)
if var == -1:
TextRect.center((700),(500)) ###########blad
else:
TextRect.center = ((disp_width/2),(disp_height/2))
display.blit(TextSurf, TextRect)
pygame.display.update()
time.sleep(3)
# Game()
def text_objects(text, font):
textSurface = font.render(text, True, black)
return textSurface, textSurface.get_rect()
Game()
pygame.quit()
quit()
TypeError: 'tuple' object is not callable.
?