[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [pygame] game freezes on start up with 1.2




>okay so here's the deal; I'm trying to write a simple game that uses
>alot of the Aliens code and the some tiling code from twitch. it was
>working on pygame 1.1, but it freezes up when i installed 1.2.  it seems
>to blit the background to the screen and then it freezes.

ok, i've found the problem. pygame is not really 'freezing', it

is actually doing exactly what it is being told to do. unfortunately,
it is being told to "pygame.time.delay(342954096)". so after waiting for 
about 4 days, your game will actually start fine!

here's the problem:
when you create the FpsClock instance, it is calling 
pygame.time.get_ticks(). this functrion returns the number of 
milliseconds since pygame was initialized. since pygame has not 
initialized when you call this, it seems to be returning garbage. 
(apparantly on linux it does not return garbage). i don't remember 
chancing anything that would effect this between pygame v1.1 and v1.2. 
my guess is that something has changed in SDL, ohwell. here's the solutions.


what you need to do:
for now, just call your "timer = FpsClock()" _after_ you call the 
pygame.init() function.

why i need to do:
have the get_ticks() function always return 0, if pygame has not been 
initialized. with this in place, it won't be a problem when you call 
pygame.time.get_ticks(), and therefore, the FpsClock class won't get all 
confused.







____________________________________
pygame mailing list
pygame-users@seul.org
http://pygame.seul.org