python - Basic Pygame Program Not Executing -


An animation test was typed into this Python code, I was expecting some errors, but this program only executes

/ P>

> pygame.init ()

to load the phantom image files and later , Sound

  class processes (object): @staticmethod Def load _image (imagefile): image = pygame.image.load (imagefile) Return image, image.get_rect ()   

Sprite class

  class Sprite (Pygame .sprite.Sprite): def __init__ (self): pygame.sprite.Sprite .__ init__ (self) self.image, self.rect = Processes.load_image ('frame1.jpg')   < P> Simple animation function - To make life easier  
  Def animation (self, key_evolution): If key_event == K_DOWN: self.rect.centery = self.rect.centery - 10 Key_event == of_UP: self right. Centry = self.rec T.centery + 10 if key_event == K_RIGHT: self.rect.centerx = self.rect.centerx + 10 if key_event == K_LEFT: self.rect.centerx = self.rect.centerx - 10 return self .   

Main job:

  def main (): mecha = sprite () allsprites = pygame.sprite.RenderPlain ((mecha,))   

Game loop:

  while correct: page = pygame.display.set_mode ((400, 400)) pygame.display.set_caption ('Animation Test') Pajima .event.get () for events in: if event.type == KEYDOWN: mecha.animation (event.key) if event.Type == QUIT: pygame.quit () sys.exit (0) allsprites.draw ( Page) pygame. Display.update ()   

Here is the real 'error'

  C: / Khan's family / Python / daughters versus The zombies / BVJD_Animatext   

Now this output is:

  (nothing) C: / Khan family / Python / daughters versus Zombies   

There is no output, and this is my problem

What do I think when an error occurs? . "You have to click the X button to close it, you will have to spam, and the error will appear in. On this Patialular program, the error is:

  file" C: / Python 32 / Projects / Delayable Use ", line 45, & lt; module & gt; Allsprites.draw (surface) Name: Error: Name 'allsprites' is not defined   

That's it.

Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -