function stormer.init()

 local bullet = load_particle("stormer_bullet.obj")
 local gun_missile = load_particle("stormer_gun_missile.obj")

 local wave_amplitude = 0.3
 local wave_frequency = 0.05
 local speed_start = 0.2
 local speed_increase = 0.005

 function stormer.gun(worm)
  local dx,dy = angle_vector(worm:angle(),3)
  local object = worm:shoot(gun_missile,1,0,0,0,0,0,200,2)
  object:set_spd(dx,dy)
  local object = worm:shoot(gun_missile,1,0,0,0,0,0,160,2)
  object:set_spd(dx,dy)
 end

 function stormer.shoot(worm)
  for a=1, 3 do
  local missile = worm:shoot(bullet, 1, 0, 0, 0, 0, 0, 0, 0)
   missile:data().time = worm:angle() + worm:current_weapon():ammo() * 20 + a
   missile:data().speed = speed_start + math.sin(a * worm:angle()) * 0.2
   missile:data().angle = worm:angle()
  end
 end


 function stormer.think(object)
  local time = object:data().time + wave_frequency

  local angle = object:data().angle

  local speed = object:data().speed + speed_increase
  
  local x1, y1 = angle_vector(angle, speed)
  local x2, y2 = angle_vector(angle + 90, math.sin(time) * wave_amplitude * speed)

  object:set_spd(x1 + x2, y1 + y2)
  object:data().time = time
  object:data().speed = speed
 end
end
