ObjectData = 
{
	MotionModel = 
	{
		DefaultAnimation = [[normal]],
		Motions = 
		{
			motion4 = 
			{
				Animations = 
				{
					anim1 = 
					{
						Path = [[DATA:Animations\Marshmallow Bud\marsh_bud_angry_smack.anim]],
						Name = [[marsh_bud_angry_smack]],
						MinFreq = 1.000000,
						MaxFreq = 1.000000,
					},
				},
				Name = [[hit]],
			},
			motion1 = 
			{
				Animations = 
				{
					anim1 = 
					{
						Path = [[DATA:Animations\Marshmallow Bud\marsh_bud_angry_being_eaten_half_frame.anim]],
						Name = [[marsh_bud_angry_being_eaten]],
						MinFreq = 1.000000,
						MaxFreq = 1.000000,
					},
				},
				Name = [[eaten]],
			},
			motion3 = 
			{
				Animations = 
				{
					anim1 = 
					{
						Path = [[DATA:Animations\Marshmallow Bud\marsh_bud_angry_toolbar.anim]],
						Name = [[marsh_bud_angry_toolbar]],
						MinFreq = 1.000000,
						MaxFreq = 1.000000,
					},
				},
				Name = [[toolbar]],
			},
			motion2 = 
			{
				Animations = 
				{
					anim4 = 
					{
						Path = [[DATA:Animations\Marshmallow Bud\marsh_bud_angry_squint.anim]],
						Name = [[marsh_bud_angry_squint]],
						MinFreq = 4.000000,
						MaxFreq = 8.000000,
					},
					anim5 = 
					{
						Path = [[DATA:Animations\Marshmallow Bud\marsh_bud_angry_squint_left.anim]],
						Name = [[marsh_bud_angry_squint_left]],
						MinFreq = 4.000000,
						MaxFreq = 8.000000,
					},
					anim1 = 
					{
						Path = [[DATA:Animations\Marshmallow Bud\marsh_bud_angry_look_left.anim]],
						Name = [[marsh_bud_angry_look_left]],
						MinFreq = 9.000000,
						MaxFreq = 16.000000,
					},
					anim8 = 
					{
						Path = [[DATA:Animations\Marshmallow Bud\marsh_bud_angry_look_blink.anim]],
						Name = [[marsh_bud_angry_look_blink]],
						MinFreq = 3.000000,
						MaxFreq = 5.000000,
					},
					anim6 = 
					{
						Path = [[DATA:Animations\Marshmallow Bud\marsh_bud_angry_squint_right.anim]],
						Name = [[marsh_bud_angry_squint_right]],
						MinFreq = 4.000000,
						MaxFreq = 8.000000,
					},
					anim7 = 
					{
						Path = [[DATA:Animations\Marshmallow Bud\marsh_bud_angry_look_down.anim]],
						Name = [[marsh_bud_angry_look_down]],
						MinFreq = 9.000000,
						MaxFreq = 16.000000,
					},
					anim3 = 
					{
						Path = [[DATA:Animations\Marshmallow Bud\marsh_bud_angry_look_up.anim]],
						Name = [[marsh_bud_angry_look_up]],
						MinFreq = 9.000000,
						MaxFreq = 16.000000,
					},
					anim2 = 
					{
						Path = [[DATA:Animations\Marshmallow Bud\marsh_bud_angry_look_right.anim]],
						Name = [[marsh_bud_angry_look_right]],
						MinFreq = 9.000000,
						MaxFreq = 16.000000,
					},
				},
				Name = [[normal]],
			},
			motion5 = 
			{
				Animations = 
				{
					anim1 = 
					{
						Path = [[DATA:Animations\Marshmallow Bud\marsh_bud_angry_look_up.anim]],
						Name = [[marsh_bud_angry_look_up]],
						MinFreq = 1.000000,
						MaxFreq = 1.000000,
					},
				},
				Name = [[alt_collision]],
			},
		},
	},
	Extensions = 
	{
		EdibleExtension = 
		{
			Eaters =
			{
				"whale",
				"eets_angry",
				"eets_happy",
				"eets_scared",
				"squirrel",
			},
			emotion_name = [[angry]],
			emotion_value = 1001.000000,
		},
		PhysicsExtension = 
		{
			mass = 1.000000,
			static_friction = 0.300000,
			restitution = 0.400000,
			kinetic_friction = 0.050000,
			platform_breaker = true,
		},
		LevelEditorExtension = 
		{
			rotate_icon_offset = {-60,-40},
			trash_icon_offset = {-41,26},
			rotate_divisions = 8.000000,
			teleportable = true,
		},
		PositionExtension = 
		{
		},
		ThwackableExtension = 
		{
		},
		SuckableExtension = 
		{
		},
		AltCollisionExtension = 
		{
		},
	},
}

-- Begin Scripting --

help_text_header = "$00643"
help_text = "$00644"

function OnInit()	
	this:SetAltCollision("marsh_bud_angry_look_up")
	
	this:CreateEffect( "marshmallow_bud/flame" )
	
end

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

		flame = this:CreateEffect( "marshmallow_bud/flame" )

		return
	end
end

function Update()

	Profile_Start("marsh_bug_angry")

	UpdateEffects()

	local suckable_ext = this:GetSuckableExtension()
	local motion_model = this:GetMotionModel()

	if suckable_ext then
	
		if suckable_ext:WasRecentlySucked() then
			if motion_model:GetCurrentMotionName() ~= "eaten" then
				motion_model:PushMotion( "eaten", false, true )
			end
		else
			--go back to default
			if motion_model:GetCurrentMotionName() == "eaten" then
				motion_model:PopMotion()
			end
		end
		
	end
	
	Profile_Stop("marsh_bug_angry")
	
end

