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

//-------Aliases-------//
private alias 63 : TYPE_CONVEYORBELT


// Static Values

// Tables

event ObjectMain
	foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)
		if object[currentPlayer].gravity == GRAVITY_GROUND
			BoxCollisionTest(C_TOUCH, object.entityPos, object.value1, -20, object.value2, 0, currentPlayer, HITBOX_AUTO, HITBOX_AUTO, HITBOX_AUTO, HITBOX_AUTO)
			if checkResult == 1
				object[currentPlayer].xpos += object.xvel
			end if
		end if
	next
end event


event ObjectStartup
	foreach (TypeName[Conveyor Belt], arrayPos0, ALL_ENTITIES)
		object[arrayPos0].value1 = object[arrayPos0].propertyValue
		object[arrayPos0].value1 <<= 4
		object[arrayPos0].value2 = object[arrayPos0].value1
		FlipSign(object[arrayPos0].value1)
		if object[arrayPos0].direction == FLIP_NONE
			object[arrayPos0].xvel = 0x20000
		else
			object[arrayPos0].xvel = -0x20000
		end if
	next
end event

event RSDKDraw
	DrawSprite(0)
end event

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