Here's an example:
dim unit_selected(9)
for objectno=1 to 10
make object cube objectno,10
position object objectno,rnd(250)-125,0,rnd(250)-125
next objectno
camx#=0 : camz#=0
position camera camx#,200,camz#
xrotate camera 60
set camera range 100,400
sync rate 60
sync on
dim gummiband(4)
do
if gummiband=0 and (mousex()>screen width()-5 or rightkey()=1) then inc camx#,6
if gummiband=0 and (mousex()<5 or leftkey()=1) then dec camx#,6
if gummiband=0 and (mousey()<5 or upkey()=1) then inc camz#,6
if gummiband=0 and (mousey()>screen height()-5 or downkey()=1) then dec camz#,6
position camera camx#,200,camz#
rem unit selection code
if mouseclick()=1 and gummiband=0
if keystate(42)=0 and keystate(54)=0
for unit=0 to 9
unit_selected(unit)=0
next unit
endif
gummiband=1
mposx=mousex()
mposy=mousey()
endif
while mouseclick()=1
line mposx,mposy,mposx,mousey()
line mposx,mousey(),mousex(),mousey()
line mousex(),mousey(),mousex(),mposy:gummiband(0)=mousex():gummiband(1)=mousey()
line mousex(),mposy,mposx,mposy
sync
endwhile
if mouseclick()=0 and gummiband=1
if abs(mposx-mousex())<5 and abs(mposy-mousey())<5
for unit=0 to 9
if abs(mousex()-object screen x(unit+1))<10 and abs(mousey()-object screen y(unit+1))<10
unit_selected(unit)=1
gummiband=0
exit
endif
next unit
endif
if gummiband=1
for unit=0 to 9
if object screen x(unit+1)>=mposx and object screen x(unit+1)<=mousex() and object screen y(unit+1)>=mposy and object screen y(unit+1)<=mousey() then unit_selected(unit)=1
if object screen x(unit+1)<=mposx and object screen x(unit+1)>=mousex() and object screen y(unit+1)<=mposy and object screen y(unit+1)>=mousey() then unit_selected(unit)=1
if object screen x(unit+1)<=mposx and object screen x(unit+1)>=mousex() and object screen y(unit+1)>=mposy and object screen y(unit+1)<=mousey() then unit_selected(unit)=1
if object screen x(unit+1)>=mposx and object screen x(unit+1)<=mousex() and object screen y(unit+1)<=mposy and object screen y(unit+1)>=mousey() then unit_selected(unit)=1
next unit
gummiband=0
endif
endif
for unit=0 to 9
if unit_selected(unit)=1
color object unit+1,rgb(255,0,0)
else
color object unit+1,rgb(255,255,255)
endif
next unit
sync
loop
"If you can't make it good
make it look good."
Bill Gates