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

Re: [pygame] Optimizing a noise-maker



On Sat, 2006-07-08 at 22:48 +0200, Rikard Bosnjakovic wrote:
> At the end of each level for my game, the screen is supposed to become
> "noisy" (like a TV with no show on). Currently, I'm doing this:

We did this effect awhile ago for an old pygame font effect contest.
Yes, plotting the pixels was way too slow.

Solution!

We plotted a smaller area of random pixels. Then blitted that as tiles
to the larger area. Everytime you draw the random pixels you offset them
on the screen by a random amount. You could also "flip" and "transpose"
the image randomly each frame.

Since you only have to plot random pixels for a smaller area one time
this works very fast. In fact you could even load it from an image and
use the same technique to jitter it around.