function main(self)

    if self.State == 0 then
		self:SetImage("CUSTOM_METEOR_PROJECTILE")
		self:SetAnimation("GAME_CYCLE50")
		self.Flags.AlwaysActive = true
		self.AttackRect, self.MoveRect = {0,0,21,21}, {0,0,21,21}
		self.PhysicsType = PhysicsTypes.Fly
		self.Damage = 15
		self.TargetX, self.TargetY = self.X + 500, self.Y + 500
		if self.SpeedX == 0 then self.SpeedX = 9 end
		if self.SpeedY == 0 then self.SpeedY = 9 end
		self.State = 1
	end

	if self.State == 1 or self.State == 2 then
		self:AnimationStep()
		local rect = self.AttackRect
		CreateObject{
			X = self.X + rect.Left + math.random(math.abs(rect.Left - rect.Right)),
			Y = self.Y + rect.Top + math.random(math.abs(rect.Top - rect.Bottom)),
			Z = self.Z + 1,
			name = "Sparkle",
			image = "CUSTOM_SPARKLERED"
		}
	end

	if self.State == 1 then
		self.X = self.X + self.SpeedX
		self.Y = self.Y + self.SpeedY
		if self.Y > self.TargetY - 100 then
			self.HitFlags.Enemy = true
			self.BumpFlags.MagicBullet = true
			self.State = 2
		end
	end

	if self.State == 2 then
		local result = self:Physics(self.X + self.SpeedX, self.Y + self.SpeedY)
		if result > 0 then
			self.State = 3
		end
		if self.Y > GetClaw().Y + 1000 then
			self:Destroy()
		end
	end

	if self.State == 3 then
		CreateObject{
			X = self.X,
			Y = self.Y,
			Z = 4500,
			name = "ArtifactPower:FireEssenceExplosion"
		}
		PlaySound("CUSTOM_METEOR_STRIKE" .. math.random(2))
		Earthquake(500)
		self:Destroy()
	end
end