Path: blob/master/Sonic 2/Scripts/MPZ/ConveyorBelt.txt
1483 views
// ----------------------------------1// RSDK Project: Sonic 22// Script Description: Conveyor Belt Object3// Script Author: Christian Whitehead/Simon Thomley4// Unpacked by Rubberduckycooly's script unpacker5// ----------------------------------67// ========================8// Aliases9// ========================1011private alias object.value1 : object.hitbox.left12private alias object.value2 : object.hitbox.right1314// Player Aliases15private alias object.xpos : player.xpos16private alias object.gravity : player.gravity171819// ========================20// Events21// ========================2223event ObjectUpdate24foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)25if player[currentPlayer].gravity == GRAVITY_GROUND26BoxCollisionTest(C_TOUCH, object.entityPos, object.hitbox.left, -20, object.hitbox.right, 0, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)27if checkResult == true28player[currentPlayer].xpos += object.xvel29end if30end if31next32end event333435event ObjectStartup36foreach (TypeName[Conveyor Belt], arrayPos0, ALL_ENTITIES)37object[arrayPos0].hitbox.left = object[arrayPos0].propertyValue38object[arrayPos0].hitbox.left <<= 439object[arrayPos0].hitbox.right = object[arrayPos0].hitbox.left40FlipSign(object[arrayPos0].hitbox.left)4142// Direction is set from the editor43if object[arrayPos0].direction == FLIP_NONE44object[arrayPos0].xvel = 0x2000045else46object[arrayPos0].xvel = -0x2000047end if48next49end event505152// ========================53// Editor Events54// ========================5556event RSDKDraw57DrawSprite(0)5859if editor.showGizmos == true60editor.drawingOverlay = true6162// Draw the Conveyor Belt's hitbox6364// Right hitbox65temp2 = object.propertyValue66temp2 <<= 46768// Left hitbox (just mirrored)69temp0 = temp27071temp1 = 20; temp3 = 0;72CallFunction(EditorHelpers_DrawHitbox)7374editor.drawingOverlay = false75end if76end event777879event RSDKLoad80LoadSpriteSheet("Global/Display.gif")81SpriteFrame(-8, -8, 16, 16, 168, 18) // "trigger" - #08283SetVariableAlias(ALIAS_VAR_PROPVAL, "size")84end event858687