Thanks Shockwave - this is how I originally had it set up but for some reason it didnt work.
this is my code at the present time - I want to be able to ascertain whether the swarm has bumped into each other . . .
#include once "tinyptc_ext.bi"
const xres = 640
const yres = 480
Dim Shared as Integer sf,a,lpx,lpy,sw,hsc,r,g,b
sf=128:r=255:g=255:b=255
Dim shared as double x(sf),y(sf),x1(sf),y1(sf)
ptc_allowclose(0)
ptc_setdialog(1,"Would you like to go Fullscreen?",0,1)
If( ptc_open( "Swarm 2", XRES, YRES ) = 0 ) Then
End -1
End If
for a=0 to sf-1
x(a)=16+(int(rnd(1)*xres)-16)
y(a)=16+(int(rnd(1)*yres)-16)
x1(a)=-1+int(rnd(1)*2)
y1(a)=-1+int(rnd(1)*2)
if x1(a)=0 then x1(a)=1
if y1(a)=0 then y1(a)=1
next
Declare Sub Clr
Declare Sub Swarm
Declare Sub CheckCollision
Dim Shared as Integer sb(xres*yres)
#define pp(x,y,argb) sb(y*XRES+x)=argb
WHILE(GETASYNCKEYSTATE(VK_SPACE)<> -32767 and PTC_GETLEFTBUTTON=FALSE)
Clr
Swarm
' CheckCollision
ptc_update @sb(0)
Wend
Sub Clr
for a=0 to xres-1
for b=0 to yres-1
pp(a,b,rgb(0,0,0))
next b
next a
End Sub
Sub Swarm
for a=0 to sf-1
x(a)=x(a)+x1(a)
y(a)=y(a)+y1(a)
if x(a)<16 then x1(a)=1
if x(a)>xres-16 then x1(a)=-1
if y(a)<16 then y1(a)=1
if y(a)>yres-16 then y1(a)=-1
for l=0 to 7
sw=int(rnd(1)*l)
pp(x(a),(xres*sw)+y(a),rgb(r,g,b))
pp(x(a),(-xres*sw)+y(a),rgb(r,g,b))
pp(sw+x(a),y(a),rgb(r,g,b))
pp(-sw+x(a),y(a),rgb(r,g,b))
next l
next a
End Sub
Sub CheckCollision
for a=0 to sf-1
'how do i check for objects hitting?
next a
End Sub
I think it explains it better?
DrewPee