Dodic, you have been ticking all of us off recently with your posts telling us about the new projects you seem to start every few hours.
However, I've decided to have a go at solving your problem - providing that you at least try to finish this project!
I've spent a while working on the code below because it's DBC - rather than DBPro, where what you want is quite easy to do. It's not an ideal way to do it I know, but it works in DBC.
Therefore, I will be annoyed if you announce yet another project before you've shown us this one up and running!
Rem Select Objects (Troops) On Matrix Example
Rem By TDK_Man
Set Display Mode 800,600,32
Sync On: Sync Rate 0
CLS 0
Randomize Timer()
AutoCam Off
Dim MatPosXZ(1)
Create Bitmap 1,300,300
CLS RGB(0,100,0)
Get Image 1,0,0,256,256
CLS RGB(55,55,0)
Get Image 2,0,0,256,256
Delete Bitmap 1
Make Matrix 1,1000,1000,50,50
Prepare Matrix Texture 1,1,1,1
Position Camera -100,300,-100
Point Camera 500,0,500
For N=1 to 200
Make Object Cube N,3
Position Object N,Rnd(1000),2,Rnd(1000)
Next N
Do
Mx=MouseX(): My=MouseY(): Mc=MouseClick()
If Mc=1
FindMatrixXZ(Mx,My): rem MatX=MatPosXZ(0): MatZ=MatPosXZ(1)
Mx1=MatPosXZ(0): Mz1=MatPosXZ(1)
Repeat
Mx=MouseX(): My=MouseY(): Mc=MouseClick()
If Mx>Mx1 and My>My1
FindMatrixXZ(Mx,My): Mx2 = MatPosXZ(0): Mz2 = MatPosXZ(1)
Endif
MatSelection(Mx1,Mz1,Mx2,Mz2)
Until Mc=0
For N=1 to 200
If Object Position X(N)>Mx1 and Object Position X(N)<Mx2 and Object Position Z(N)>Mz2 and Object Position Z(N)<Mz1
Color Object N,RGB(255,0,0)
Else
Color Object N,RGB(255,255,255)
Endif
Next N
Endif
Sync
Loop
Function FindMatrixXZ(Mx,My)
Make Object Sphere 1000,10: Position Object 1000,0,0,0: Hide Object 1000
Repeat
If Object Screen X(1000) <= Mx
Position Object 1000,Object Position X(1000)+2,Object Position Y(1000),Object Position Z(1000)
Else
Position Object 1000,Object Position X(1000)-2,Object Position Y(1000),Object Position Z(1000)
Endif
If object screen y(1000) <= My
Position Object 1000,Object Position X(1000),Object Position Y(1000),Object Position Z(1000)-2
Else
Position Object 1000,Object Position X(1000),Object Position Y(1000),Object Position Z(1000)+2
Endif
Until ABS(Object Screen X(1000)-Mx)<3 and ABS(Object Screen Y(1000)-My)<3
MatPosXZ(0) = Object Position X(1000): MatPosXZ(1) = Object Position Z(1000)
Delete Object 1000
EndFunction
Function MatSelection(Mx1,Mz1,Mx2,Mz2)
Make Object Plain 2000,Mx2-Mx1,Mz2-Mz1
Texture Object 2000,2
Ghost Object on 2000
XRotate Object 2000,90
Position Object 2000,ABS(Mx2-Mx1)/2+Mx1,2,ABS(Mz1-Mz2)/2+Mz2
Sync
Delete Object 2000
EndFunction
TDK_Man