hey anybody know to make my bullets stay alive for ever and ever ????
or make it that when the bullets hit a planet it explodes and when the ship falls into the atmosphere of the planet it blows up
rem Space Flight Code, by The Darthster!
rem Initialization
sync on
sync rate 0
hide mouse
autocam off
set normalization on
color backdrop 0,0
set camera range 1,999999
`images
load image "grass.bmp",3
load image "untitled.bmp",1
load image "real-clouds.jpg",4
`planet 1
make object sphere 14,10000,100,100
position object 14,100,100,100
texture object 14,1
SET LIGHT MAPPING ON 14,2
xrotate object 14,70
turn object left 14, 1.0
set object light 14, 1
make object sphere 15,10300,100,100
position object 15,100,100,100
texture object 15,4
SET LIGHT MAPPING ON 15,4
xrotate object 15,70
turn object left 15, 1.0
set object light 15, 1
`music
load music "1.mp3",1
play music 1
loop music 1
rem Make a terrain to fly over
make matrix 1,100000,100000,50,50
SET MATRIX WIREFRAME OFF 1
prepare matrix texture 1,3,1000,1000
fill matrix 1,1000,1
rem Make a really rather bad cockpit, and lock it to the screen
load object "space fighter 2.x",11
scale object 11,20000,20000,9000
`texture object 11,3
show object 11
position object 11,0,-30,200
lock object on 11
xrotate object 11,180
zrotate object 11,180
SET OBJECT AMBIENT 11,1
set object light 11, 1
SET OBJECT SMOOTHING 11,0
GHOST OBJECT ON 15
`make object box 12,2,50,2
`position object 12,7,15,10
`xrotate object 12,330
`lock object on 12
`texture object 12,2
`make object box 13,2,50,2
`position object 13,-7,15,10
`xrotate object 13,330
`lock object on 13
`texture object 13,2
rem Set up initial positions and angles
x#=5000
y#=2000
z#=5000
theta#=0
phi#=0
gamma#=0
thruststep#=0.1
rem Set up bullets
dim shot#(10,10000)
for i=0 to 9
make object sphere i+1,5
color object i+1,RGB(255,0,0)
ghost object on i+1
next i
do
rem Mouseclicks control speed
if mouseclick()=1 then thrust#=thrust#+thruststep#
if mouseclick()=2 then thrust#=thrust#-thruststep#
rem Now the joystick button controls speed
`if joystick fire a()=1 then thrust#=thrust#+thruststep#
rem Keyboard controls speed
if keystate(16)=1 then thrust#=thrust#-thruststep#
if keystate(17)=1 then yaxisstrafe#=yaxisstrafe#-thruststep#
if keystate(18)=1 then thrust#=thrust#+thruststep#
if keystate(30)=1 then xaxisstrafe#=xaxisstrafe#-thruststep#
if keystate(31)=1 then yaxisstrafe#=yaxisstrafe#+thruststep#
if keystate(32)=1 then xaxisstrafe#=xaxisstrafe#+thruststep#
rem Shooting
rem Putting in a firing delay
if spacekey()=1 and shotrecently#=0
shotrecently#=4
for i=0 to 10
rem If the bullet is 'dead' then create a new one
if shot#(i,0)=0
rem Alive
shot#(i,0)=1
rem Current position
shot#(i,1)=x#
shot#(i,2)=y#
shot#(i,3)=z#
rem Current velocities plus velocities provided by the gun
shot#(i,4)=xvel#+(sin(theta#)*cos(phi#)*20)
shot#(i,5)=yvel#-(sin(phi#)*20)
shot#(i,6)=zvel#+(cos(theta#)*cos(phi#)*20)
rem Angle
shot#(i,7)=theta#
shot#(i,8)=phi#
rem Life
shot#(i,9)=30
show object i+1
exit
endif
next i
endif
if shotrecently#>0 then shotrecently#=shotrecently#-1
rem Update the bullets
for i=0 to 9
rem If the bullet is 'alive' then move it by it's velocity
if shot#(i,0)=1
shot#(i,1)=shot#(i,1)+shot#(i,4)
shot#(i,2)=shot#(i,2)+shot#(i,5)
shot#(i,3)=shot#(i,3)+shot#(i,6)
position object i+1,shot#(i,1),shot#(i,2),shot#(i,3)
shot#(i,9)=shot#(i,9)-1
rem If it's just run out of 'life' then 'kill' it and make
rem it available for use again
if shot#(i,9)=0
hide object i+1
shot#(i,0)=0
endif
endif
next i
rem Mouse movements control angles
theta#=curveangle(theta#+mousemovex(),theta#,7)
phi#=curveangle(phi#+mousemovey(),phi#,7)
remstart
if mousex()>=640 then position mouse 640,mousey()
if mousex()<=0 then position mouse 0,mousey()
if mousey()>=480 then position mouse mousex(),480
if mousey()<=0 then position mouse mousex(),0
if mousex()>=340 then theta#=wrapvalue(theta#+((mousex()-340)*0.015))
if mousex()<=300 then theta#=wrapvalue(theta#+((mousex()-300)*0.015))
if mousey()>=260 then phi#=wrapvalue(phi#-((mousey()-260)*0.015))
if mousey()<=220 then phi#=wrapvalue(phi#-((mousey()-220)*0.015))
remend
rem Keyboard controls angles
if upkey()=1 then phivel#=curvevalue(-5,phivel#,20)
if downkey()=1 then phivel#=curvevalue(5,phivel#,20)
if leftkey()=1 then thetavel#=curvevalue(-5,thetavel#,20)
if rightkey()=1 then thetavel#=curvevalue(5,thetavel#,20)
if upkey()=0 and downkey()=0 then phivel#=curvevalue(0,phivel#,10)
if leftkey()=0 and rightkey()=0 then thetavel#=curvevalue(0,thetavel#,10)
theta#=wrapvalue(theta#+thetavel#)
phi#=wrapvalue(phi#+phivel#)
`oldtheta#=theta#
`oldphi#=phi#
`theta#=wrapvalue(theta#+mousemovex())
`phi#=wrapvalue(phi#+mousemovey())
rem Joystick controls angles
`theta#=wrapvalue(theta#+(joystick x()*0.005))
`phi#=wrapvalue(phi#-(joystick y()*0.005))
if phi#>90 and phi#<180 then phi#=90
if phi#<270 and phi#>180 then phi#=270
rem Decay the thrust so you don't go really fast
thrust#=thrust#*0.9
xaxisstrafe#=xaxisstrafe#*0.9
yaxisstrafe#=yaxisstrafe#*0.9
rem Accelerate the velocities (this took ages to work out)
xvel#=xvel#+(sin(theta#)*cos(phi#)*thrust#)
yvel#=yvel#-(sin(phi#)*thrust#)
zvel#=zvel#+(cos(theta#)*cos(phi#)*thrust#)
xvel#=xvel#+(sin(theta#+90)*xaxisstrafe#)
zvel#=zvel#+(cos(theta#+90)*xaxisstrafe#)
xvel#=xvel#+(sin(theta#)*cos(phi#+90)*yaxisstrafe#)
yvel#=yvel#-(sin(phi#+90)*yaxisstrafe#)
zvel#=zvel#+(cos(theta#)*cos(phi#+90)*yaxisstrafe#)
rem Some friction to stop you going too fast
xvel#=xvel#*0.99
yvel#=yvel#*0.99
zvel#=zvel#*0.99
rem Simple velocity
x#=x#+xvel#
y#=y#+yvel#
z#=z#+zvel#
`rem Screen display
`text 0,0,"X velocity:"
`text 0,20,"Y velocity:"
`text 0,40,"Z velocity:"
`text 0,60,"Theta:"
`text 0,80,"Phi:"
`text 0,100,"Thrust:"
`text 100,0,str$(xvel#)
`text 100,20,str$(yvel#)
`text 100,40,str$(zvel#)
`text 100,60,str$(theta#)
`text 100,80,str$(phi#)
`text 100,100,str$(thrust#)
rem Rotate and position the camera
position camera x#,y#,z#
yrotate camera theta#
xrotate camera phi#
sync
loop
here are the media files
http://www.alpha-project.dbspot.com/space.zip
and can u make the explosions the ones in the explosion example ???
thank u in advance