[racket] get-pixel

From: Sébastien Cano (hkjangshu at gmail.com)
Date: Tue Nov 30 15:44:06 EST 2010

Hi,
I'm currently working on a Space Invaders, and I have an issue.
When a laser is fired,
get-pixel<http://docs.racket-lang.org/gui/bitmap-dc_.html?q=get-pixel#%28meth._%28%28%28lib._mred/main..rkt%29._bitmap-dc%7E25%29._get-pixel%29%29>uses
its coordinates to send the color of the pixel at these coordinates to
a color% object at every tick.
Since the background is black and that the invaders are white, when (> (send
my-color-object blue) 0 ) (which gives the 0-255 blue value) , my program
starts to look for a dead flagged invader and removes it from the list. An
invader is considered as dead when a laser enters its perimeter.
However, it seems get-pixel is very slow when called at every tick. When you
fire 2 lasers, it becomes unplayable.
And of course, calling it every 2 ticks or more is not efficient enough.
Feel free to give me your thoughts on this...

Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20101130/0bd606fe/attachment.html>

Posted on the users mailing list.