options = {}

function think (self,player,params)
	local fx =math.sin(self.age*.05)
	if math.abs(fx)>.8 then
		fx = fx<0 and -.5 or .5
	else fx = 0
	end
	local fx,fy,fz = self.body:local2world(fx,-.15,0)
	local x,y,z = self.body:pos()
	self.body:addforce(fx-x,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+math.min(60,math.max(-60,vx*6)),
		(rz-self.rz)*.5+self.rz)
	self.reload = math.min(10,(self.reload or 0) + 1)
	if math.sin (self.age*.1)>.95 and self.reload>0 then
		self.reload = self.reload -12
		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
end

function getPreview()
	return {}
end
