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

[pygame] USEREVENT ignored (?) after approx. 20 events



Hello,

I am using events to warn about collisions in my game. I have the following
code to do that:

    def checkcollisions(self):
        for spr in self.collideswith():
            self.oncollide(spr)
            spr.oncollide(self)
            ev = pygame.event.Event(COLLISION)
            ev.dict['sprites'] = (self, spr)
            debug("  PUT:", ev)
            pygame.event.post(ev)
            debug("  NOW:", pygame.event.peek(COLLISION))

I get (partially) the following output:

    33  DEBUG: 1045944275.91 '  PUT:' <Event(24-UserEvent {'sprites': (<Brian sprite(in 3 groups) id="400e768c" pos=(1618, 1130)>, <Lolly sprite(in 0 groups) id="4013592c" pos=(1621, 1165)>)})>
    34  DEBUG: 1045944275.91 '  NOW:' 1
    35  DEBUG: 1045944280.90 '  PUT:' <Event(24-UserEvent {'sprites': (<Brian sprite(in 3 groups) id="400e768c" pos=(1543, 980)>, <Lolly sprite(in 0 groups) id="4184816c" pos=(1514, 986)>)})>
    36  DEBUG: 1045944280.90 '  NOW:' 1
    37  DEBUG: 1045944300.01 '  PUT:' <Event(24-UserEvent {'sprites': (<Brian sprite(in 3 groups) id="400e768c" pos=(1539, 1021)>, <Lolly sprite(in 0 groups) id="40135aac" pos=(1500, 1059)>)})>
    38  DEBUG: 1045944300.01 '  NOW:' 0
    39  DEBUG: 1045944301.40 '  PUT:' <Event(24-UserEvent {'sprites': (<Brian sprite(in 3 groups) id="400e768c" pos=(1434, 1096)>, <Lolly sprite(in 0 groups) id="418483cc" pos=(1439, 1137)>)})>
    40  DEBUG: 1045944301.40 '  NOW:' 0

So, what's going wrong with the '.post' function call?
Is this a bug or am I misunderstanding something?

This is happening after 10-63 event posts and 16-61 seconds.
I do not really see a clear link between the two[0].

I also tried to .clear() the method queue because it might be
polluted with irrelevant events, but this made no difference.

I am using Pygame 1.5.5, Python 2.3a2, Linux 2.4.17, GCC 2.96.

yours,
Gerrit.

[0]
I tried eight times, those are the results:
16 collisions --> 21.47 seconds
20 collisions --> 17.78 seconds
45 collisions --> 16.50 seconds
40 collisions --> 18.06 seconds
31 collisions --> 16.55 seconds
63 collisions --> 22.04 seconds
10 collisions --> 65.37 seconds
18 collisions --> 25.01 seconds

-- 
Asperger Syndroom - een persoonlijke benadering:
	http://people.nl.linux.org/~gerrit/
Het zijn tijden om je zelf met politiek te bemoeien:
	http://www.sp.nl/
____________________________________
pygame mailing list
pygame-users@seul.org
http://pygame.seul.org