[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] PyGame Windows Key Behaviour



Hi Thomas,
  can you just post all the code? in particular what's missing is seeing how the player ball and cpu are moved and how those things relate together. There are definitely people on the list who could easily identify the cause of your problem in an instant with that information.

Also, there a number of techniques that could be used that would prevent the problem you are describing from ever occuring, and it would be easier to communicate how such techniques work if we could see where you are coming from now.

thanks

On Mon, Jan 31, 2011 at 3:22 AM, Thomas <pummer.thomas@xxxxxxxxx> wrote:
Hi there!

I've written a small demo pong game. There are 2 players, one is cpu
controlled. To sync there movement i use

clock = pygame.time.Clock()

and in the while loop:

milli = clock.tick()
seconds = milli/1000.

on checking the events it's:

if event.type == KEYDOWN:
   if event.key == K_DOWN:
       b_y += seconds * playerspeed

cpu changes his position with an equal function, until it reaches the
height of the ball

under winXP cpu and player can move with an equal speed
under win7 the player is significant slower than the cpu. it seems
that a player only can move 2/3 the distance than the cpu player is
able to

Do you have any hint's what can be done to fix this?

with kind regards
Thomas