options = {}

function think (self,player,params)
	local fx,fy,fz = self.body:local2world(0,-.12,0)
	local x,y,z = self.body:pos()
	self.body:addforce((fx-x)*3,fy-y,0)
	
	
	local rx,ry,rz = self.body:rotdeg()
	local vx,vy,vz = self.body:velocity()
	self.body:rotdeg((rx-self.rx)*.5+self.rx,
		(ry-self.ry)*.5+self.ry,
		(rz-self.rz)*.5+self.rz)
	
	
	self.reload = math.min(10,(self.reload or 0) + 1)
	
	if math.sin (self.age*.5)>.95 and self.reload>0 then
		self.reload = self.reload -16
		for i,p in ipairs{{10,5,0},{-10,5,0}} do
			local px,py = self.body:local2world(unpack(p))
			local fx,fy = self.body:local2world(0,-6,0)
			
			self.game:fireprojectile("enemylaser",px,py,fx-x,fy-y,1)
		end
	end
	
	if math.sin (self.age*.5)<-.95 and self.reload>0 then
		self.reload = self.reload -20
		for i,p in ipairs{{20,5,0},{-20,5,0}} do
			local px,py = self.body:local2world(unpack(p))
			local fx,fy = self.body:local2world(0,-6,0)
			
			self.game:fireprojectile("enemylaser",px,py,fx-x,fy-y,1)
		end
	end
end

function getPreview()
	return {}
end
