Re: [pygame] Game not running

2012-03-12 Thread Avirup Kundu
Well i used the pickle module.. Like this! def highscore(s): with open('highscore.pkl', 'r+b') as f: score = pickle.load(f) for i in range(len(score)): if s > score[i-1]: score[len(score)-1] = s break score.sort() score.reverse() with ope

Re: [pygame] Game not running

2012-03-11 Thread Christopher Arndt
Am 11.03.12 18:11, schrieb Avirup Kundu: I tried the file approach but being a newbie couldn't make anything. I will try the sqlite. It will be easier i believe . Let's see.. Using sqlite is certainly not easier than using plain files (though it can be more robust, depending on your use case).

Re: [pygame] Game not running

2012-03-11 Thread Avirup Kundu
I tried the file approach but being a newbie couldn't make anything. I will try the sqlite. It will be easier i believe . Let's see..

Re: [pygame] Game not running

2012-03-11 Thread Nick Arnoeyts
There are multiple ways to do this. You can probably write all the scores to a file, and then load that file when you start your game again. I'd take a look at sqlite, which is a miniature embedded database designed for this purpose. Op 11 maart 2012 18:05 schreef Avirup Kundu het volgende: > An

Re: [pygame] Game not running

2012-03-11 Thread Avirup Kundu
Another question. How can i implement a Highscores function in the game? After the ends, it will display along with the current score the previous 5 highest scores? Any resources i can read up or code i can look into?

Re: [pygame] Game not running

2012-03-11 Thread Avirup Kundu
Ok! It was the images! Thanks a lot!!

Re: [pygame] Game not running

2012-03-11 Thread Zack Baker
You have to have your images in the same folder as your script. Are they? For example if you copied to the desktop it wouldn't work -Zack On Mar 11, 2012, at 12:51 PM, Avirup Kundu wrote: > import pygame, os.path, sys > from pygame.locals import * > from random import randint > > def load_ima

Re: [pygame] Game not running

2012-03-11 Thread Nick Arnoeyts
Are your image files always located in the folder where your script is? If not, you're probably getting errors because the script can't find your images. Also, can you run your script via the commandline when it's outside the Python32 folder and tell us what error you're getting? Op 11 maart 2012

Re: [pygame] Game not running

2012-03-11 Thread Avirup Kundu
import pygame, os.path, sys from pygame.locals import * from random import randint def load_image(name, colorkey=None): try: image = pygame.image.load(name) except pygame.error: print ('Cannot load image:', name) raise SystemExit(str(geterror())) image = image.c

Re: [pygame] Game not running

2012-03-11 Thread Nick Arnoeyts
Without seeing the source, I'd say your code depends on something in the Python32 folder. That said, it could be a lot of other things. We can't really do much without the code. Op 11 maart 2012 17:44 schreef Avirup Kundu het volgende: > I wrote a game and it is executing perfectly when it resid