Posts: 292
Threads: 31
Joined: Apr 2003
Part of this program I'm working on requires hunderds of dots to move around on the screen (not particle animation, though). How do I tell when one has run into another without taking up too much memory or time? This thing needs to run fast. It sounds simple, but.... The screen area will be 200x200 with several hundred dots.
Thanks in advance.
Posts: 3,368
Threads: 195
Joined: Jan 2003
you need to store your dots in two formats.
The first is two x, y arrays.
The second is a map array.
Then, you just check the surrounding locations whenever you want to move a dot. If it is not empty, don't move it.
Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."
Visit www.neobasic.net to see rubbish in all its finest.
Posts: 480
Threads: 24
Joined: Mar 2003
you can use the POINT command to see what color a given pixel is on the screen. if the background is black, you can just do
IF POINT(x, y) THEN
' this coordinate has a dot on it
END IF
That ought to do the trick.
*peace*
Meg.