ObjectData = 
{
	MotionModel = 
	{
		DefaultAnimation = [[normal]],
		Motions = 
		{
			motion4 = 
			{
				Animations = 
				{
					anim1 = 
					{
						Path = [[DATA:Animations\Star\star_alt.anim]],
						Name = [[star_alt]],
						MinFreq = 1.000000,
						MaxFreq = 1.000000,
					},
				},
				Name = [[alt_collision]],
			},
			motion3 = 
			{
				Animations = 
				{
					anim1 = 
					{
						Path = [[DATA:Animations\Star\starman_curls.anim]],
						Name = [[starman_curls]],
						MinFreq = 1.000000,
						MaxFreq = 1.000000,
					},
				},
				Name = [[hit]],
			},
			motion2 = 
			{
				Animations = 
				{
					anim1 = 
					{
						Path = [[DATA:Animations\Star\starman_toolbar.anim]],
						Name = [[starman_toolbar]],
						MinFreq = 1.000000,
						MaxFreq = 1.000000,
					},
				},
				Name = [[toolbar]],
			},
			motion1 = 
			{
				Animations = 
				{
					anim1 = 
					{
						Path = [[DATA:Animations\Star\starman_faces.anim]],
						Name = [[starman_faces]],
						MinFreq = 1.000000,
						MaxFreq = 1.000000,
					},
				},
				Name = [[normal]],
			},
		},
	},
	Extensions = 
	{
		EdibleExtension = 
		{
			Eaters =
			{
				"whale",
			},
		},
		PhysicsExtension = 
		{
		},
		LevelEditorExtension = 
		{
			rotate_icon_offset = {-60,-45},
			rotate_divisions = 8.000000,
		},
		InternalForceExtension = 
		{
			counteractGravityPercent = 1.000000,
		},
		PositionExtension = 
		{
		},
		AltCollisionExtension = 
		{
		},
		ThwackableExtension = 
		{
		},
	},
}

-- Begin Scripting --

help_text_header = "$00663"
help_text = "$00664"

function OnInit()

	this:SetAltCollision("star_alt")
	this:CreateEffect( "star/sprinkle" )

end

function UpdateEffects()
	if not sprinkle or not sprinkle:IsValid() then
		current_position = this:GetPosition()

		sprinkle = this:CreateEffect( "star/sprinkle" )

		return
	end
end

function Update()

	Profile_Start("star")

	UpdateEffects()

	local motion_model = this:GetMotionModel()

	for report in this:GetCollisionReports() do

		if report.relative_velocity:LengthSqr() > 10 then
			
			if motion_model:GetCurrentMotionName() ~= "hit" then
				motion_model:PushMotion("hit", false, false)
				Sound_CreateSound( "Star Hit", false, 0, this:GetPosition() )
			end
			
			break
		end
		
	end
	
	Profile_Stop("star")

end

