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

// This Object is used in the Boss Rush, for the Spring Yard Boss - TODO: fill in proper info

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

// Player Aliases
private alias object.iypos : player.iypos


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

event ObjectUpdate
	if game.missionCondition == MISSION_CONDITION_CLEAR
		// If the Boss is defeated, then make sure the Player doesn't fall through the floor and die
		if player[0].iypos >= 0x580
			player[0].iypos = 0x580
		end if
	end if
end event


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

event RSDKDraw
	DrawSprite(0)
	
	if editor.drawgizmos == true
		temp0 = object.xpos
		temp0 -= 0x200000
		
		editor.drawingOverlay = true
		
		// todo: idr if w/h is screen-space or not
		// this prolly doesn't work at all either
		DrawRectWorld(temp0, 0x5800000, 0x400000, 0x20000, 255, 0, 255, 255)
		DrawLine(object.xpos, object.ypos, object.xpos, 0x5800000, 255, 0, 255)
		
		editor.drawingOverlay = true
	end if
end event


event RSDKLoad
	LoadSpriteSheet("Global/Display.gif")
	SpriteFrame(-16, -16, 32, 32, 1, 143)
	
	SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
end event
