Hey terry, i made an example, it works like this:
you select the units with the left mouse button and holding it to make a box, and you righ click to make the units move somewhere
here is the code:
// Circles when selected!
Sync On
Sync Rate 60
Backdrop On
Color Backdrop 0
Type XY
X As Integer
Y As Integer
EndType
Type Unit
SNum as Integer
Selected as Boolean
Target as XY
Pos as XY
Going as Boolean
EndType
Global Mouse
Global MX
Global MY
Global Draw
Dim Units(3) as Unit
For Z = 1 To 4
M As Float
M = Z*0.25
Ink RGB(M*255, M*61, M*216), 0
Box 0, 0, 50, 50
Get Image Z, 0, 0, 50, 50
CLS
Next X
Sprite 1, 200, 150, 1
Sprite 2, 600, 150, 2
Sprite 3, 200, 450, 3
Sprite 4, 600, 450, 4
For X = 1 to 4
Offset Sprite X, 25, 25
Next X
For Z = 0 to 3
Units(Z).SNum = Z+1
Units(Z).Pos.X = Sprite X(Z+1)
Units(Z).Pos.Y = Sprite Y(Z+1)
Next Z
Do
UpdateBox()
UpdateUnits()
Mouse = MouseClick()
Sync
Loop
Function UpdateUnits()
Ink RGB(19, 237, 255), 0
If Draw = 1
For Z = 0 to 3
If PosInBox(Sprite X(Units(Z).SNum), Sprite Y(Units(Z).SNum))
FilledCircle(Sprite X(Units(Z).SNum), Sprite Y(Units(Z).SNum), 40)
Units(Z).Selected = 1
Else
Units(Z).Selected = 0
EndIf
Next Z
EndIf
If Draw = 0
For Z = 0 To 3
If Units(Z).Selected Then FilledCircle(Sprite X(Units(Z).SNum), Sprite Y(Units(Z).SNum), 40)
If MouseClick() = 2
If Units(Z).Selected Then SetTarget(Z, MouseX(), MouseY())
EndIf
Next Z
EndIf
For Z = 0 To 3
If Units(Z).Going = 1
U = Units(Z).SNum
TX = Units(Z).Target.X
TY = Units(Z).Target.Y
X = Sprite X(U)+(TX - Sprite X(U))*0.01
Y = Sprite Y(U)+(TY - Sprite Y(U))*0.01
Sprite U, X, Y, Sprite Image(U)
EndIf
Next Z
SpriteSLide(1, 2)
SpriteSlide(1, 3)
SpriteSLide(1, 4)
SpriteSlide(2, 3)
SpriteSlide(2, 4)
SpriteSlide(3, 4)
EndFunction
Function SetTarget(Ent, X, Y)
Units(Ent).Target.X = X
Units(Ent).Target.Y = Y
Units(Ent).Going = 1
EndFunction
Function UpdateBox()
If Draw = 0
If MouseClick() = 1 AND Mouse = 0
Draw = 1
MX = MouseX()
MY = MouseY()
EndIf
Else
Ink RGB(255, 255, 255), 0
Box Smallest(MX, MouseX()), Smallest(MY, MouseY()), Biggest(MX, MouseX()), Biggest(MY, MouseY())
If MouseClick() = 0 Then Draw = 0
EndIf
EndFunction
Function PosInBox(X, Y)
RetVal = 0
If X => Smallest(MX, MouseX()) And X <= Biggest(MouseX(), MX)
If Y => Smallest(MY, MouseY()) And Y <= Biggest(MouseY(), MY)
RetVal = 1
EndIf
EndIf
EndFunction RetVal
Function Biggest(A, B)
RetVal = 0
If A > B Then RetVal = A
If B > A Then RetVal = B
EndFunction RetVal
Function Smallest(A, B)
RetVal = 0
If A < B Then RetVal = A
If B < A Then RetVal = B
EndFunction RetVal
Function FilledCircle(X, Y, Rad)
For Z = 1 To Rad
Circle X, Y, Z
Next X
EndFunction
Function XYDist(X1, Y1, X2, Y2)
X = X1 - X2
Y = Y1 - Y2
C = ((X*X)+(Y*Y))^0.5
EndFunction C
function SpriteSlide(moveable as dword, stationary as dword)
if sprite collision(moveable, stationary) = 0 then exitfunction
local move_x as dword
local move_y as dword
local stat_x as dword
local stat_y as dword
move_x = sprite x(moveable) + sprite width(moveable) / 2
move_y = sprite y(moveable) + sprite height(moveable) / 2
stat_x = sprite x(stationary) + sprite width(stationary) / 2
stat_y = sprite y(stationary) + sprite height(stationary) / 2
if move_x > stat_x
reso_x = (sprite x(stationary) + sprite width(stationary)) - (sprite x(moveable))
else
reso_x = (sprite x(stationary)) - (sprite x(moveable) + sprite width(moveable))
endif
if move_y > stat_y
reso_y = (sprite y(stationary) + sprite height(stationary)) - (sprite y(moveable))
else
reso_y = (sprite y(stationary)) - (sprite y(moveable) + sprite height(moveable))
endif
if abs(reso_x) > abs(reso_y)
reso_x = 0
else
reso_y = 0
endif
sprite moveable, sprite x(moveable) + reso_x, sprite y(moveable) + reso_y, sprite image(moveable)
endfunction
Hope it helps