Quote: "Don’t try to use the pick object command in an RTS."
He couldn't even if he wanted to. As was stated earlier in the thread it simply isn't present in DB Classic!!
You've cleverly explained all the easy bits of the process, skipping the difficult part that people can't do with:
Quote: "You will need crank a bit of maths to convert the mouse coordinate which are given in pixels 2D style to 3D coordinate in your game."
Here's one method of selecting multiple troops, though you'll find loads more info if you use the
Search button:
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