function init()
	gun.name = "Spawner asteroids"
	gun.shotrange = 2000
	gun.fireDelay = 750
	
	return 0
end


function update()

	return 0
end


function fire()
	--randomize direction of asteroid placement
	local theta = math.random(0,359)
	
	ax = gun.firex + math.cos(math.rad(theta))*gun.shotrange
	ay = gun.firey + math.sin(math.rad(theta))*gun.shotrange
	
	--randomize size of the asteroid
	size = ""
	spin = math.random() - .5
	roll = math.random(1,21)
	if roll <= 10 then
		size = "Asteroid1"
		spin = spin * 6
	elseif roll > 10 and roll <= 20 then
		size = "Asteroid2"
		spin = spin * 3
	elseif roll == 21 then
		size = "Asteroid3"
	end
	
	--create the asteroid and bump it
	stage.createShip(size, "null", ax,ay,0)
	ship.spin = spin
	ship.bump(math.random(0,359), math.random(500, 3000))
	
	
	for i = 1, 8 do
		ax = ax + math.random(-300,300)
		ay = ay + math.random(-300,300)
		
		gun.addShot("explode4.png", ax, ay, theta+90)
		--shot.speed = 150
		shot.lifetimer = 8000
		--shot.durable = 1
		shot.damage = .1
		shot.knockback = 3000
		shot.scale = 1.0 + math.random()
		
		--attach a trail emitter to the shot
		stage.createEmitter("trail", 0, 0)
		e.alpha = .15
		e.interval = 15
		e.attach(shot)
		e.upload()
	end

	return 0
end

function shot_update()

	return 0
end