// ----------------------------------
// RSDK Project: Sonic 2
// Script Description: Eggman SmokePuff Object
// Script Author: Christian Whitehead/Simon Thomley
// Unpacked by Rubberduckycooly's script unpacker
// ----------------------------------

// ========================
// Events
// ========================

event ObjectUpdate
	object.xpos += object.xvel
	object.ypos += object.yvel

	if object.outOfBounds == true
		// Erase the object as soon as it's OOB, it's not too important anyways
		object.type = TypeName[Blank Object]
	end if

	// Animate the object
	object.frame = object.animationTimer
	object.frame /= 14
	object.animationTimer++
	if object.frame == 4
		object.type = TypeName[Blank Object]
	end if
end event


event ObjectDraw
	DrawSprite(object.frame)
end event


event ObjectStartup
	CheckCurrentStageFolder("Zone05")
	if checkResult == true
		LoadSpriteSheet("HTZ/Objects.gif")
		SpriteFrame(-8, -6, 16, 13, 52, 1)
		SpriteFrame(-8, -7, 15, 14, 52, 15)
		SpriteFrame(-8, -7, 15, 14, 37, 117)
		SpriteFrame(-7, -6, 12, 12, 53, 119)
	else
		LoadSpriteSheet("MBZ/Objects.gif")
		SpriteFrame(-8, -6, 16, 13, 903, 71)
		SpriteFrame(-8, -7, 15, 14, 903, 85)
		SpriteFrame(-8, -7, 15, 14, 913, 109)
		SpriteFrame(-7, -6, 12, 12, 929, 111)
	end if
end event


// ========================
// Editor Events
// ========================

event RSDKDraw
	DrawSprite(0)
end event


event RSDKLoad
	CheckCurrentStageFolder("Zone05")
	if checkResult == true
		LoadSpriteSheet("HTZ/Objects.gif")
		SpriteFrame(-8, -6, 16, 13, 52, 1)
	else
		LoadSpriteSheet("MBZ/Objects.gif")
		SpriteFrame(-8, -6, 16, 13, 903, 71)
	end if

	SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
end event
