Well my code is such garbage, I may be to embarrased

, but ok....
The command to play the sound is included in the explosion subroutine at the very end...
`Vital project stats
`Name: Worlds at war
`Started: wednesday, December 22, 2004
`Genre: Strategy
`Author: Jerad Laxson
`Programmer: Jerad Laxson
`Artist: Jerad Laxson
`Music by Epic Games, Digital extremes, and Atari
set display mode 1024,768,16
Set camera range 1,10000
set current bitmap 0
xrotate camera 90
`interface
load image "interface.jpg",1000
`buy menu
load image "buymenu.jpg",1001
load image "infomenu.jpg",1002
position mouse screen width()/2, screen height()/2
rem the new mouse object to play with
make object cube 8000,10
position object 8000,0,0,0
set object collision to boxes 8000
color object 8000,RGB(128,128,0)
`creates a space image for the backdrop
load image "space.jpg",1
backdrop on
texture backdrop 1
autocam off
`load sounds
`music
load sound "song2.mp3",1
loop sound 1
set sound volume 1,20
load sound "nukeboom.wav",2
`PLANETARY ARRAYS
dim earth(0)
dim venus(0)
dim mercury(0)
dim jupider(0)
dim mars(0)
dim saturn(0)
dim neptune(0)
dim uranus(0)
dim pluto(0)
dim planetx(0)
`Other ARRAYS
dim victorytimer(0)
dim selection(0)
dim player(0)
`resource arrays.
dim money(0)
dim jeradium(0)
dim energy(0)
`planet variables
`earth
dim earthair(0)
dim earthground(0)
earthair(0)=100
earthground(0)=100
`venus
dim venusair(0)
dim venusground(0)
venusair(0)=0
venusground(0)=80
`mercury
dim mercair(0)
dim mercground(0)
mercair(0)=0
mercground(0)=60
`mars
dim marsair(0)
dim marsground(0)
marsair(0)=60
marsground(0)=100
`jupider
dim jupiterair(0)
dim jupiterground(0)
jupiterair(0)=50
jupiterground(0)=100
`saturn
dim saturnair(0)
dim saturnground(0)
saturnair(0)=70
saturnground(0)=100
`uranus
dim uranusair(0)
dim uranusground(0)
uranusair(0)=50
uranusground(0)=100
`neptune
dim neptuneair(0)
dim neptuneground(0)
neptuneair(0)=50
neptuneground(0)=80
`pluto
dim plutoair(0)
dim plutoground(0)
plutoair(0)=0
plutoground(0)=20
`camera variables!
x#=0
z#=0
y#=200
`Planetary variabes 0=neutral, 1=player, 2=enemy
earth(0)=1
venus(0)=0
mercury(0)=0
jupider(0)=0
mars(0)=0
saturn(0)=0
neptune(0)=0
uranus(0)=0
pluto(0)=0
planetx(0)=2
`resources
money(0)=1000
jeradium(0)=1000
energy(0)=1000
`VICTORY TIMER
victorytimer(0)=1000
dim fighterhealth(0)
dim battleshiphealth(0)
dim destroyerhealth(0)
`make planets
mercury=1
load object "mercury.x",mercury
load bitmap "mercuryuv.bmp",2
get image 2,0,0,512,512
texture object mercury,2
delete bitmap 2
set object collision on mercury
position object mercury,-400,-100,0
venus=2
load object "venus.x",venus
load bitmap "venus.bmp",3
get image 3,0,0,512,512
texture object venus,3
delete bitmap 3
set object collision on venus
position object venus, -200,-100,0
earth=3
load object "earth.x",earth
set object collision on earth
position object earth,0,-30,0
load bitmap "earthuv.bmp",4
get image 4,0,0,512,512
texture object earth,4
delete bitmap 4
scale object earth,100,100,100
mars=4
load object "MARS.x",mars
load bitmap "marsuv.bmp",5
get image 5,0,0,512,512
texture object mars,5
delete bitmap 5
set object collision on mars
position object mars,200,-50,0
scale object mars,100,100,100
jupider=5
load object "jupider.x", jupider
set object collision on jupider
load bitmap "jupideruv.bmp",6
get image 6,0,0,512,512
texture object jupider,6
delete bitmap 6
position object jupider, 400,0,0
saturn=6
load object "saturn.x",saturn
load bitmap "saturnuv.bmp", 7
get image 7,0,0,512,512
texture object saturn,7
delete bitmap 7
set object collision on saturn
position object saturn, 600, 0,0
neptune=7
load object "neptune.x",neptune
load bitmap "neptuneuv.bmp",8
get image 8,0,0,512,512
texture object neptune,8
delete bitmap 8
set object collision on neptune
position object neptune,800,0,0
uranus=8
load object "uranus.x",uranus
load bitmap "uranusuv.bmp",9
get image 9,0,0,512,512
texture object uranus,9
delete bitmap 9
set object collision on uranus
position object uranus, 1000, 0,0
pluto=9
make object sphere pluto, 15
color object pluto,RGb(0,0,255)
set object collision on pluto
position object pluto, 1200, 0,0
`planet x
planetx=10
load object "planetx.x",planetx
load bitmap "planetxuv.bmp",11
get image 11,0,0,512,512
texture object planetx,11
delete bitmap 11
set object collision on planetx
position object planetx, 1300,0,0
`make asteroids
load bitmap "asteroiduv.bmp",12
get image 12,0,0,512,512
delete bitmap 12
for asteroids=11 to 50
load object "asteroid.x",asteroids
texture object asteroids,12
position object asteroids, 250+rnd(20),0,-700+rnd(2000)
rotate object asteroids,rnd(20),rnd(20),rnd(20)
next asteroids
`make the units
fighter=60
load object "fighter.x",fighter
load bitmap "fighteruv.bmp",13
get image 13,0,0,128,128
texture object fighter,13
delete bitmap 13
position object fighter,30,0,20
set object collision on fighter
battleship=61
make object cube battleship,10
set object collision on battleship
position object battleship,20,0,20
destroyer=62
make object cube destroyer,15
set object collision on destroyer
position object destroyer,20,0,30
`make a ship for mercury
mercship=63
load object "fighter.x",mercship
texture object mercship,13
position object mercship,40,0,0
set object collision on mercship
hide object mercship
venusship=64
load object "fighter.x",venusship
texture object venusship,13
position object venusship,-200,0,-15
set object collision on venusship
hide object venusship
`make miners
miner=65
make object cube miner,5
set object collision on miner
position object miner,1000,1000,1000
hide object miner
`make nuke
nuke=90
make object box nuke,5,5,5
set object collision on nuke
position object nuke,1000,1000,1000
explosion=1000
make object sphere explosion,5
ghost object on explosion
fade object explosion,100
hide object explosion
explosion2=1001
make object sphere explosion2,3
ghost object on explosion2
hide object explosion2
fade object explosion,100
`make the dock
earthdock=9000
make object box earthdock, 5,5,60
position object earthdock,-80,0,0
set object collision on earthdock
`special planet ships, arrays
dim mercship(0)
dim venusship(0)
dim minerhealth(0)
`unit variables, stores their health.
fighterhealth(0)=30
battleshiphealth(0)=50
destroyerhealth(0)=70
mercship(0)=50
venusship(0)=50
minerhealth(0)=100
Player(0)=1
`random variables
buymenu=0
minerexist=0
nukeexist=0
nukeactive=0
nukelife=1000
`main loop!
sync on
sync rate 60
do
gosub selection
set ambient light ambientlight
paste image 1000,600,600,1
`prints the unit's health.
set cursor 10,10: print "fighter health=",fighterhealth(0)," battleship health=",battleshiphealth(0)," destroyer health=",destroyerhealth(0)
`prints your resources
set cursor 10,50: print " victory in",victorytimer(0)
set cursor 703,622: print money(0)
set cursor 703,675: print jeradium(0)
set cursor 708,725: print energy(0)
`print the mouses position
set cursor 10,100: print mousex()
set cursor 10,150: print mousey()
`info menu!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
`this gives info on the planets
if keystate(23)=1 and infomenu=0
infomenu=1
endif
if keystate(23)=0 and infomenu=1
infomenu=0
endif
if infomenu=1
paste image 1002,200,200
`mercury info
set cursor 311,287: print mercair(0)
set cursor 305,306: print mercground(0)
`venus info
set cursor 556,283: print venusair(0)
set cursor 548,307: print venusground(0)
`earth info
set cursor 313,365: print earthair(0)
set cursor 303,388: print earthground(0)
`mars info
set cursor 558,363: print marsair(0)
set cursor 550,386: print marsground(0)
`jupiter info
set cursor 312,446: print jupiterair(0)
set cursor 303,470: print jupiterground(0)
`saturn info
set cursor 558,444: print saturnair(0)
set cursor 556,466: print saturnground(0)
`uranus info
set cursor 315,522: print uranusair(0)
set cursor 304,547: print uranusground(0)
`neptune info
set cursor 556,525: print neptuneair(0)
set cursor 546,545: print neptuneground(0)
`pluto info
set cursor 441,613: print plutoair(0)
set cursor 430,637: print plutoground(0)
endif
`the buy menu!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
`!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
if buymenu=0
if scancode()=48
buymenu=1
tigger=1
endif
endif
if buymenu=1
paste image 1001,600,300
set cursor 650,360: Print "press 1 to buy a mining vessel(1 allowed)"
set cursor 650,500: Print "Press 2 for a nuke $10000,10000J,10000W"
set cursor 740,322: print "BUY MENU"
`let them get their finger off the button, first!
if tigger=1 then wait 200 : tigger=0
if scancode()=48 then buymenu=0 : wait 200
endif
`buy a mining vessel
if buymenu=1 and keystate(2)=1
if money(0)>0 and minerexist=0
money(0)=money(0)-500
set cursor 500,500: print "mining vessel purchased"
position object miner,0,0,-50
show object miner
minerexist=1
wait 200
buymenu=0
endif
endif
`buy a nuke
if buymenu=1 and keystate(3)=1 and nukeexist=0
if money(0)>0 and jeradium(0)>0 and energy(0)>0
money(0)=money(0)-500: jeradium(0)=jeradium(0)-500: energy(0)=energy(0)-500
set cursor 500,500: Print "Nuke purchased"
position object nuke,0,0,50
show object nuke
nukeexist=1
wait 200
buymenu=0
else
nukeexist=0
endif
endif
`!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
`make a nuke and launch it
if nukeexist=1
set cursor 600,400: Print "press N to activate nuke, then click where you want to fire the nuke"
point object nuke, object position x(8000), object position y(8000), object position z(8000)
if keystate(49)=1 and mouseclick()=1
nukelaunched=1
endif
endif
if nukelaunched=1
move object nuke,1
endif
if object collision(nuke,0)>0
hide object nuke
gosub nukeboom
nukeexist=0
nukelaunched=0
else
explode=0
endif
`end nuke stuff
`This is the dock healing process, when a unit enterst the dock, it's health is raised by 1
scale object fighter,fighterhealth(0),fighterhealth(0),fighterhealth(0)
scale object battleship,battleshiphealth(0),battleshiphealth(0),battleshiphealth(0)
scale object destroyer,destroyerhealth(0),destroyerhealth(0),destroyerhealth(0)
scale object mercship,mercship(0),mercship(0),mercship(0)
scale object venusship,venusship(0),venusship(0),venusship(0)
if object collision(fighter,earthdock)>0 and fighterhealth(0)<80
fighterhealth(0)=fighterhealth(0)+1
endif
if object collision(battleship,earthdock)>0 and battleshiphealth(0)<100
battleshiphealth(0)=battleshiphealth(0)+1
endif
if object collision(destroyer,earthdock)>0 and destroyerhealth(0)<150
destroyerhealth(0)=destroyerhealth(0)+1
endif
if object collision(mercship,earthdock)>0 and mercship(0)<80
mercship(0)=mercship(0)+1
endif
if object collision(venusship,earthdock)>0 and venusship(0)<80
venusship(0)=venusship(0)+1
endif
`collision with mercury
for fleet=60 to 64
if object collision(fleet,mercury)>0 and mercury(0)=0 or mercury(0)=2
victorytimer(0)=victorytimer(0)-1
if object collision(fleet,mercury)>0 and victorytimer(0)=0
mercury(0)=1
endif
endif
next fleet
if victorytimer(0)<1
victorytimer(0)=victorytimer(0)+1000
endif
if mercury(0)=1
show object mercship
endif
`collision between the fleet and venus
for fleet=60 to 62
if object collision(fleet,venus)>0 and venus(0)=0 or venus(0)=2
victorytimer(0)=victorytimer(0)-1
if object collision(fleet,venus)>0 and victorytimer(0)=0
venus(0)=1
endif
endif
next fleet
if venus(0)=1
show object venusship
endif
`collision between fleet and mars
for fleet=60 to 64
if object collision(fleet,mars)>0 and mars(0)=0 or mars(0)=2
victorytimer(0)=victorytimer(0)-1
if object collision(fleet,mars)>0 and victorytimer(0)=0
mars(0)=1
money(0)=money(0)+1000
energy(0)=energy(0)+1000
endif
endif
next fleet
for fleet=60 to 64
if object collision(fleet,jupider)>0 and jupider(0)=0 or jupider(0)=2
victorytimer(0)=victorytimer(0)-1
if object collision(fleet,jupider)>0 and victorytimer(0)=0
jupider=1
energy(0)=energy(0)+2000
money(0)=money(0)+1000
endif
endif
next fleet
`mining vessel and asteroids
for asteroids=11 to 50
if object collision(miner,asteroids)>0
set cursor 800,90: print "mining asteroid"
jeradium(0)=jeradium(0)+1
endif
next asteroids
`Camera stuff!
position camera 0+x#,0+y#,0+z#
`moves camera right
if rightkey()=1 and x#<2000
x#=x#+5
endif
`moves camera left
if leftkey()=1 and x#>-2000
x#=x#-5
endif
`moves camera up
if upkey()=1 and z#<500
z#=z#+5
endif
`moves camera down
if downkey()=1 and z#>-500
z#=z#-5
endif
sync
loop
selection:
rem the new object selection code
rem -- here we move the user selection cube...
if object screen x(8000)=<mousex()
position object 8000,object position x(8000)+4,object position y(8000),object position z(8000)
endif
if object screen x(8000)=>mousex()
position object 8000,object position x(8000)-4,object position y(8000),object position z(8000)
endif
if object screen y(8000)=<mousey()
position object 8000,object position x(8000),object position y(8000),object position z(8000)-4
endif
if object screen y(8000)=>mousey()
position object 8000,object position x(8000),object position y(8000),object position z(8000)+4
endif
rem the select bit (replace with distance equation) Player 1
if player(0)=1
if mouseclick()=1
rem -- here we move any object selected by the user
if selection(0)
position object selection(0),object position x(8000),object position y(8000),object position z(8000)
else
t = object collision(8000,0)
rem -- here we test for all user movable objects...
if t > 59 and t < 86
selection(0) = t
endif
endif
else
selection(0) = 0
endif
endif
return
nukeboom:
for particles=1002 to 1020
if explode<2000 and explode2<1000
position object explosion,object position x(nuke), object position y(nuke), object position z(nuke)
position object explosion2,object position x(nuke), object position y(nuke), object position z(nuke)
show object explosion
show object explosion2
if sound playing(2)=0
play sound 2
explode=explode+10
scale object explosion,explode,explode,explode
explde2=explde2+5
scale object explosion2,explode2,explode2,explode2
else
position object explosion,10000,10000,10000
position object explosion2,10000,10000,10000
endif
endif
next particles
return
Guns arn't the problem, people are the problem, shoot all the people and guns arn't a problem anymore.