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

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

event ObjectUpdate
	// Empty event, it exists but there's nothing in it
end event


event ObjectDraw
	DrawSprite(0)
end event


event ObjectStartup
	LoadSpriteSheet("Special/Objects.gif")
	
	// 0 - Spotlight Frame
	SpriteFrame(-24, -6, 48, 13, 350, 376)

	foreach (TypeName[Spotlight], arrayPos0, ALL_ENTITIES)
		object[arrayPos0].drawOrder = 3

		// Move the Spotlight to the middle of the screen
		object[arrayPos0].xpos = screen.xcenter
		object[arrayPos0].xpos <<= 16

		if object[1].type != TypeName[Blank Object]
			// If there's a second player, move the spotlights to make room for two
			if object[arrayPos0].propertyValue == 0
				object[arrayPos0].xpos += 0x200000
			else
				object[arrayPos0].xpos -= 0x200000
			end if
		end if
	next
end event


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

event RSDKDraw
	DrawSprite(0)
end event


event RSDKLoad
	LoadSpriteSheet("Special/Objects.gif")
	SpriteFrame(-24, -6, 48, 13, 350, 376)
	
	SetVariableAlias(ALIAS_VAR_PROPVAL, "playerID")
end event
