LightningEnemy = class(CenteredObject, function(o, x, y, world)
	CenteredObject.init(o,x,y,10*r_scale,10*r_scale)
	o.world = world
	o.sprite = sprites['enemies']['bolt.png']
	o.h = o.sprite:getTexHeight()
	o.w = o.sprite:getTexWidth()
	o:setColor(0, 0, 0)
	o.moves = true
	o.acceleration.y = 40*r_scale
	o.sheet = sheets['enemies']
	o.entity:setSheet(o.sheet)
	o.damageAmount = 1
	if box2d then
		o.b2d = BludBox2dRect(box2d, o.pos.x, o.pos.y, o.w/2, o.h/2, 1, 0.4, 0.4, true)
		o.b2d:setData(o)
	end
end)

function LightningEnemy:update()
	Enemy.update(self)
	self.rot = math.deg(math.pi - self.velocity:angle() - math.pi/2)
	if self:overlap(self.world.groundPlane) then
		self:kill()
	end
end
function LightningEnemy:handleCollision(other)
	if other:is_a(Room) then
		if self.alive then
			other:hit(self.damageAmount)
			pd:startList("fromOF")
			pd:addSymbol("lightning_hit")
			pd:addFloat(1)
			pd:finish("fromOF")
			self:kill()
		else
			print('lightning hitting while dead')
		end
	end
end
PollenEnemy = class(LightningEnemy, function(o, x, y, world)
	LightningEnemy.init(o, x, y, world)
	o.sprite = sprites['enemies']['pollen.png']
	o:setColor(152, 120, 85)
end)

BeePollenEnemy = class(LightningEnemy, function(o, x, y, world)
	LightningEnemy.init(o, x, y, world)
	o.sprite = sprites['enemies']['pollen.png']
	o:setColor(218, 224, 95)
end)

BombDropEnemy = class(LightningEnemy, function(o, x, y, world)
	LightningEnemy.init(o, x, y, world)
	o.svg = SvgLoader(svg_root .. "boss/bomb.svg", true)
	o.drawType = 'svg'
	o.damageAmount = game_settings["bomb_drop_damage"] or 2
	o.w = o.svg:getMaxX()
	o.h = o.svg:getMaxY()
	o.rotSpeed = (math.random()-0.5)*10
	o.brot = math.random()*2*math.pi
end)
function BombDropEnemy:update()
	LightningEnemy.update(self)
	self.rot = self.brot + bludG.elapsed*self.rotSpeed
	self.brot = self.rot
end
function BombDropEnemy:kill()
	Object.kill(self)
	mainState.particles:addRecycle(Explosion(self.pos.x, self.pos.y, 0.7))
	pd:startList("fromOF")
	pd:addSymbol("bomber_bomb")
	pd:addFloat(1)
	pd:finish("fromOF")
end

UfoBallEnemy = class(LightningEnemy, function(o, x, y, world)
	LightningEnemy.init(o, x, y, world)
	o:setColor(255, 255, 255)
	o.sprite = sprites['enemies']['ufo_ball.png']
end)
