python - Pygame. TypeError: 'pygame.Surface' object is not callable -


i new python, pygame, , coding in general.

i not know why code getting:

"typeerror: 'pygame.surface' object not callable"

and black screen.

here code:


import pygame ptypeerror: 'pygame.surface' object not callableygame.init  black = (0,0,0) white = (255,255,255) red = (255,0,0) green = (0,255,0) blue = (0,0,255)  char_sprite = pygame.image.load("man.png")  display_height = 800 display_width = 1000 dead = false framerate = 60  game_display = pygame.display.set_mode((display_width,display_height)) pygame.display.set_caption("tiny fighter") clock = pygame.time.clock()   def char(x,y):     game_dispaly.blit(char_sprite,(x,y))  x= display_width / 2 y= display_height / 2  while not dead:     event in pygame.event.get():         if event.type == pygame.quit:             dead = true      game_display.fill(green)      char_sprite(x,y)     pygame.display.update()     clock.tick(framerate)  pygame.quit() quit() 

full traceback:


traceback (most recent call last): file "/home/hayden/desktop/tiny fighter/tiny fighter.py", line 35, in char_sprite(x,y) typeerror: 'pygame.surface' object not callable


you have typo. spelled display wrong. also, misspelled method name; should char(x, y) not char_sprite(x, y).


Comments

Popular posts from this blog

html - Styling progress bar with inline style -

java - Oracle Sql developer error: could not install some modules -

How to use autoclose brackets in Jupyter notebook? -