How to check a list of types against the same list of types? Can it be done in a dual for each loop? I made a simple test prog here to show what it is I mean. Anyone who can get this working without the use of Arrays?
Any comments are welcome! - Wave
;Probewars with Types Type Probe Field X%,Y% Field health% End Type For NR = 1 To 100 P.Probe = New Probe P\X = Rnd(0,300) P\Y = Rnd(0,400) P\Health = Rnd(0,10) Next Graphics 400,300,16,0 ;Window ;use frontbuffer SetBuffer FrontBuffer() SeedRnd = MilliSecs() While Not KeyDown(1) Cls ;Move the Probe-Ps randomly For P.Probe = Each Probe P\X = P\X + Rnd( -1,1 ) P\Y = P\Y + Rnd( -1,1 ) Plot P\X,P\Y Next For P.Probe = Each Probe ; ;Do another loop or somehow check collisions against each P ; ; IF P\X = AnotherP\X and P\Y = AnotherP\Y then delete Probe ; ; If RectsOverlap(P\X,P\Y,1,1,???\X,???\Y,1,1) ; Delete Probe;in this example delete one of the Ps ; EndIf Next Flip Wend
Any comments are welcome! - Wave