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

// ========================
// Aliases
// ========================

private alias object.value18 : player.currentPlane

event ObjectUpdate
	// Match the player's visual plane
	object.drawOrder = player[0].currentPlane

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

	// Cycle through 3 frames
	object.frame++
	if object.frame >= 3
		object.frame = 0
	end if

	object.animationTimer++

	// Unload after ~half a second
	if object.animationTimer >= 22
		object.type = TypeName[Blank Object]
	end if
end event


event ObjectDraw
	DrawSpriteFX(object.frame, FX_FLIP, object.xpos, object.ypos)
end event


event ObjectStartup
	LoadSpriteSheet("Global/Items3.gif")
	SpriteFrame(0, 0, 1, 1, 1, 1)
	SpriteFrame(-3, -3, 6, 6, 150, 84)
	SpriteFrame(-8, -8, 16, 16, 157, 84)
end event


event RSDKDraw
	DrawSprite(0)
end event


event RSDKLoad
	LoadSpriteSheet("Global/Items3.gif")
	SpriteFrame(-8, -8, 16, 16, 157, 84)
	
	SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
end event
