python - What is causing my game to have really low fps -


ok finished simple game made in python , pygame , on laptop im getting 9 fps. must code. new game programming. think way animate sprites thats causing fps drop. if guys take @ sorce code great. sorry bad programming

http://www.mediafire.com/download/7f4q55gk4a853o7/life+of+bob.zip

i took @ code , found solution in changing line 392 inside __init__ method of map object from

self.currentmap = pygame.image.load(os.path.join("assets", "maps", "spawn.png")) 

to

self.currentmap = pygame.image.load(os.path.join("assets", "maps", "spawn.png")).convert() 

if have images don't need alpha channel should call convert on them.

at beginning had framerate of 18 fps it's desired 60 fps.

the key tool find bottleneck python module cprofile. next time should learn before posting wall of 500 lines of code .

also consider changing loading of image files initialization of objects list. loading images characters each time render them.


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -