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


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

event ObjectDraw
	DrawSprite(object.propertyValue)
end event


event ObjectStartup
	LoadSpriteSheet("MPZ/Objects.gif")
	SpriteFrame(-8, -32, 32, 8, 111, 83)
	SpriteFrame(-8, -32, 32, 8, 100, 126)

	foreach (TypeName[Trans Sprite], arrayPos0, ALL_ENTITIES)
		object[arrayPos0].propertyValue &= 1
		object[arrayPos0].drawOrder = 5
	next
end event


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

event RSDKEdit
	if editor.returnVariable == true
		switch editor.variableID
		case EDIT_VAR_PROPVAL // property value
			checkResult = object.propertyValue
			checkResult &= 1
			break
			
		case 0 // type
			checkResult = object.propertyValue
			checkResult &= 1
			break
			
		end switch
	else
		switch editor.variableID
		case EDIT_VAR_PROPVAL // property value
			object.propertyValue = editor.variableValue
			object.propertyValue &= 1
			break
			
		case 0 // type
			object.propertyValue = editor.variableValue
			object.propertyValue &= 1
			break
			
		end switch
	end if
end event


event RSDKDraw
	object.frame = object.propertyValue
	object.frame &= 1

	DrawSprite(object.frame)
end event


event RSDKLoad
	LoadSpriteSheet("MPZ/Objects.gif")
	SpriteFrame(-8, -32, 32, 8, 111, 83)
	SpriteFrame(-8, -32, 32, 8, 100, 126)
	
	AddEditorVariable("frameID")
	SetActiveVariable("frameID")
	AddEnumVariable("Left", 0)
	AddEnumVariable("Right", 1)
end event
