this small unfinished concept may help you doing what you want..it's planes flying from different directions attacking you..
Rem * Title : flying objects
Rem * Author : Scorpyo
Rem * Date : March 2003
rem sky = object 9990
rem ********** MAIN 1 ****************
rem set screen resolution
set display mode 800,600,16
hide mouse
rem enable sync
sync on
backdrop off
autocam off
rem matrix tile number
grid=30
rem randomize matrix height
mtxrandomize=100
rem matrix size
landsize=20000
rem sky sphere size
skysize=20000
rem number of flying objects
objnum=12
rem character start position
x#=landsize/2
z#=500
rem make matrix, skysphere and place objects
gosub Setupland1
rem make walking character (cone)
gosub Character
rem initialize variables
gosub Vars1
set global collision off
sync rate 0
rem set camera range bigger than skysphere
set camera range 1,skysize + 1000
rem *****MAIN LOOP******
do
rem restart if " r " is pressed
if inkey$()="r" then gosub reset
rem stop character at matrix borders
if x#<100 then x#=100
if x#>landsize-100 then x#=landsize-100
if z#<100 then z#=100
if z#>landsize-100 then z#=landsize-100
rem gosub walk controls
gosub Playercontrol
rem gosub fly control routine
gosub flycontrol
rem reset planes position if all passed and far
if abs(behindz#)>10000 then gosub reset
rem move object according to fly data
for n=1 to objnum : move object n,10 : next n
rem Calculate character new position data
x#=newxvalue(x#,a#,s#)
z#=newzvalue(z#,a#,s#)
rem camera to follow real-time
gosub update_camera
rem call to camera swings subroutine ( bottom key row )
gosub camera_controls
h#=get ground height(1,x#,z#)
rem active character position
position object 9999,x#,h#+5,z#
yrotate object 9999,a#
rem Sky follows active character
position object 9990,x#,0,z#
rem Update screen
sync
rem End loop
loop
rem ** SUBROUTINES ***************************
rem ****** CREATE LEVEL ******
Setupland1:
rem Make matrix
make matrix 1,landsize,landsize,grid,grid
randomize matrix 1,mtxrandomize
rem apply matrix features
update matrix 1
rem splice x direction according to objects number
count=landsize/objnum
rem make and position objects
for n=1 to objnum
rem at random z values
zeta=rnd(landsize)+6000
make object cube n,100
scale object n,100,100,300
rem put objects at precalculated x,z value and random height
position object n,count,rnd(600)+400,zeta
rem increase x at each loop
count=count+(landsize/objnum)
next n
rem Create fog and ambience
set ambient light 60
if fog available()=1
fog on
fog distance 9000
fog color rgb(150,150,255)
endif
rem Create Skysphere
make object sphere 9990,skysize
scale object 9990,100,50,100
set object 9990,1,1,0
fade object 9990,0
return
rem ******** VARIABLES ******
Vars1:
rem initial cam settings
camdist=-300
camhgt=200
camrot=0
camlen=200
rem flying objects data arrays
dim objdist#(objnum+1)
dim objangle#(objnum+1)
return
rem ***** PLAYERCONTROL *****
Playercontrol:
set cursor 0,0
set text opaque
rem debug check
print "Fps=",screen fps()
print "landsize=",landsize
print "grid=",grid
print "objects=",objnum
print "x=",x#
print "z=",z#
print "a#=",a#
print "planenum=",planenum
print "behindz#=",behindz#
rem ****Character walk with arrows****
if upkey()=1 and s#<12 then s#=s#+2
if downkey()=1 and s#>-12 then s#=s#-2
if leftkey()=1 then a#=wrapvalue(a#-4)
if rightkey()=1 then a#=wrapvalue(a#+4)
rem stop if " - "
if inkey$()="-" then s#=0.0
rem fast if " ù "
if inkey$()="ù" then s#=60.0
return
rem ****BUILD PLAYER****
rem object 9999
Character:
rem make cone
make object cone 9999,100
scale object 9999,80,100,140
rem point tip forward
xrotate object 9999,60
set object cull 9999,0
return
rem **********CAMERA CONTROLS*****************
camera_controls:
if inkey$()="<" then camrot2=wrapvalue(camrot2)+2
if inkey$()="z" then camdist=camdist+2
if inkey$()="x" then camdist=camdist-2
if inkey$()="b" then camrot=camrot+2
if inkey$()="n" then camrot=camrot-2
if inkey$()="c" then camhgt=camhgt+2
if inkey$()="v" then camhgt=camhgt-2
if inkey$()="m" then camlen=camlen+2
if inkey$()="," then camrot = 180
if inkey$()="." then gosub Resetcam
return
rem camera real-time update
update_camera:
rem Position camera to the back of the character
cx#=newxvalue(x#,wrapvalue(a#+camrot),camdist)
cz#=newzvalue(z#,wrapvalue(a#+camrot),camdist)
cy#=get ground height(1,cx#,cz#)
position camera cx#,cy#+camhgt,cz#
rem Point camera at object
point camera x#,y#+camlen+yflag,z#
return
rem camera reset
Resetcam:
camdist=-400
camhgt=400
camrot=0
camlen=200
return
rem reset start positions sub-routine
reset:
x#=landsize/2:z#=500
count=landsize/objnum
for n=1 to objnum
rem calculate random Z values
zeta=rnd(landsize)+10000
rem calculate random heights
up=rnd(600)+400
position object n,count,up,zeta
count=count+(landsize/objnum)
next n
wait 100
return
end
rem calculate fly rotation angle towards player
flycontrol:
for n=1 to objnum
rem calculate x and z position difference from player and object
diffx#=abs(object position x(9999)-object position x(n))
diffz#=abs(object position z(9999)-object position z(n))
rem calculate absolute distance
objdist#(n)=sqrt((diffx#*diffx#)+(diffz#*diffz#))
behindz#=(object position z(n)-object position z(9999))
rem don' t turn plane anymore if plane is closer than 2000
if behindz#<2000 then planenum=n:goto here
rem calculate tilt angle for objects
objangle#(n)=diffx#/objdist#(n)
rem check if object is at the left or at the right of player
rem (x difference positive or negative)
diff2x#=(object position x(9999)-object position x(n))
rem turn object accordingly
if diff2x#>0 then yrotate object n,180-(wrapvalue(objangle#(n)*100))
if diff2x#<0 then yrotate object n,wrapvalue(objangle#(n)*100)+180
here:
next n
return