[Pythonmac-SIG] pygames event.get() ?

João Leão joaoleao at gmx.net
Tue Feb 3 08:18:59 EST 2004


Earlier I didn't check the code properly
The code that moves the balll can't be inside the < if event.type...>

This is what should happen:

while 1:
	for event in pygame.event.get():   # Here's the issue
		if event.type == pygame.QUIT: sys.exit()

	ballrect = ballrect.move(speed)
	if ballrect.left < 0 or ballrect.right > width:
		speed[0] = -speed[0]
	if ballrect.top < 0 or ballrect.bottom > height:
		speed[1] = -speed[1]

	screen.fill(black)
	screen.blit(ball, ballrect)
	pytpygame.display.flip()

_
joao


> while 1:
>       for event in pygame.event.get():   # Here's the issue
>               if event.type == pygame.QUIT: sys.exit()
>
>                 ballrect = ballrect.move(speed)
>                 if ballrect.left < 0 or ballrect.right > width:
>                         speed[0] = -speed[0]
>                 if ballrect.top < 0 or ballrect.bottom > height:
>                         speed[1] = -speed[1]
>
>                 screen.fill(black)
>                 screen.blit(ball, ballrect)
>                 pygame.display.flip()




More information about the Pythonmac-SIG mailing list