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

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

private alias object.value1 : object.hitbox.left
private alias object.value2 : object.hitbox.right

// Player Aliases
private alias object.xpos : player.xpos
private alias object.gravity : player.gravity


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

event ObjectUpdate
	foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)
		if player[currentPlayer].gravity == 0
			BoxCollisionTest(C_TOUCH, object.entityPos, object.hitbox.left, -24, object.hitbox.right, 8, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)
			if checkResult == true
				player[currentPlayer].xpos -= 0x20000
			end if
		end if
	next
end event


event ObjectStartup
	foreach (TypeName[Conveyor Belt], arrayPos0, ALL_ENTITIES)
		object[arrayPos0].hitbox.left = object[arrayPos0].propertyValue
		object[arrayPos0].hitbox.left <<= 3
		object[arrayPos0].hitbox.right = object[arrayPos0].hitbox.left
		FlipSign(object[arrayPos0].hitbox.left)
	next
end event


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

event RSDKDraw
	DrawSprite(0)
end event


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