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

// This Object is normally used in the Boss Rush for CPZ and OOZ - BR2/BR2Zone02 and BR7/BR2Zone07, respectively

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

private alias object.ypos : player.ypos


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

event ObjectUpdate
	if game.missionCondition == MISSION_CONDITION_CLEAR
		// If the Boss is defeated, then make sure the Player doesn't fall below where this Object is and die
		if player[0].ypos >= object.ypos
			player[0].ypos = object.ypos
		end if
	end if
end event


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

event RSDKDraw
	DrawSprite(0)
	
	// Ignoring editor.showGizmos on purpose
	
	editor.drawingOverlay = true
	
	temp0 = object.xpos
	temp0 -= 0x200000
	temp1 = temp0
	temp1 += 0x400000
	DrawLine(temp0, object.ypos, temp1, object.ypos, 255, 255, 255)
	
	editor.drawingOverlay = false
end event


event RSDKLoad
	LoadSpriteSheet("Global/Display.gif")
	SpriteFrame(-8, -8, 16, 16, 127, 113)
	
	SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
end event
