[racket] get-pixel
Your programmer suffers from a major design flaw: you are conflating the 'model' (what data is needed to keep track of the events in my game) with its 'view' (how should the model be displayed on screen). Separate those two aspects and your program will run like a bat out of hell fire. -- Matthias
On Nov 30, 2010, at 3:44 PM, Sébastien Cano wrote:
> Hi,
> I'm currently working on a Space Invaders, and I have an issue.
> When a laser is fired, get-pixel 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.
> _________________________________________________
> For list-related administrative tasks:
> http://lists.racket-lang.org/listinfo/users