Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need some help
#1
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.
Reply
#2
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.
Reply
#3
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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)