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

Re: [pygame] How to speed up gameplay?



ant brown wrote on 2003-05-14:

> when u are going along the maze and try to go down its really hard to press
> down at the right time,
> any ideas ? need more info ?
>
In the last pacman I played, the keypresses were buffered waiting
until they become possible to perform.  So that e.g. you press Down
sometime *before* the opening in the horizontal wall and as soon as
pacman is aligned with the opening he indeed turns down.  You can even
"pre-program" a sequence of turns.  This is much more friendly to the
user than precise timing even if pacman would move one pixel at a
time.

The easy way to implement such things is to leave the game internally
running at one pixel per turn but skip the display updates every
second step.  Unless you determine ability to turn by looking for the
wall in video memory (which is usually a bad idea), the internal logic
of your game should be very fast, only the screen updates should take
noticable time...

-- 
Beni Cherniavsky <cben@users.sf.net>