Pygame - blitting to screen producing weird results? -


i have blitted image screen of program, worked fine, when tried 'animate' it, produces weird results. seems updating position produces image , on...

code input:

screen=pygame.display.set_mode((640,360),0,32) star=pygame.image.load("star.png").convert_alpha()  x = randint(80,700) y = randint(-200,-200)  while true:     event in pygame.event.get():         if event.type == quit:             pygame.quit()             sys.exit()      x-=0.1     y+=0.1     screen.blit(star,(x,y))      if y > 360:         y = randint(-200,-200)         x = randint(80,700)         screen.fill((0,0,0))      pygame.display.update() 

outcome:

http://imgur.com/i28od5b

i appreciate feedback why happens , how can fix it.

you don't blank canvas every frame. need erase old star before drawing new one.

you can see account in pygame tutorials.


Comments

Popular posts from this blog

iphone - Three second countdown in cocos2d -

hyperlink - how to do url routing in php -

c - Avoiding Extra Malloc in Linked List (node->next = NULL) -