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

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

event ObjectDraw
	// Simply draw the current frame, no animation or anything needed
	DrawSprite(object.propertyValue)
end event


event ObjectStartup
	LoadSpriteSheet("SBZ/Objects.gif")
	
	// Sprite frames
	SpriteFrame(-28, -32, 56, 64, 268, 274)
	SpriteFrame(-28, -32, 56, 64, 325, 274)

	// Setup for every object in the stage
	foreach (TypeName[Trans Sprite], arrayPos0, ALL_ENTITIES)
		// Limit the property value to 1 max
		object[arrayPos0].propertyValue &= 1

		// Set the draworder to 5 (FG)
		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
	DrawSprite(object.propertyValue)
end event


event RSDKLoad
	LoadSpriteSheet("SBZ/Objects.gif")
	SpriteFrame(-28, -32, 56, 64, 268, 274)
	SpriteFrame(-28, -32, 56, 64, 325, 274)
	
	AddEditorVariable("frameID")
	SetActiveVariable("frameID")
	AddEnumVariable("Left", 0)
	AddEnumVariable("Right", 1)
end event
