Path: blob/master/Sonic 2/Scripts/Global/YBoundAdjust.txt
1482 views
// ----------------------------------1// RSDK Project: Sonic 22// Script Description: Y Bound Adjust Object3// Script Author: Christian Whitehead/Simon Thomley4// Unpacked by Rubberduckycooly's script unpacker5// ----------------------------------67// ========================8// Aliases9// ========================1011private alias object.value0 : object.leftBoundary1213// Player Aliases14private alias object.xpos : player.xpos15private alias object.ypos : player.ypos161718// ========================19// Events20// ========================2122event ObjectUpdate23if object.propertyValue == 024temp0 = player[0].xpos25temp0 -= object.xpos26Abs(temp0)27if temp0 < 0x20000028stage.newYBoundary1 = 029stage.newYBoundary2 = object.iypos30stage.deathBoundary = object.ypos31end if32else33if player[0].ypos < object.ypos34if player[0].ypos > object[+1].ypos35temp0 = player[0].xpos36temp0 -= object.xpos37Abs(temp0)38if temp0 < 0x20000039stage.newYBoundary2 = object.iypos40stage.deathBoundary = object.ypos41if object.leftBoundary > 042stage.newXBoundary1 = object.leftBoundary43object.leftBoundary = 044end if45end if46end if47end if48end if49end event505152event ObjectStartup53foreach (TypeName[Y Bound Adjust], arrayPos0, ALL_ENTITIES)54if options.vsMode == false55if object[arrayPos0].propertyValue == 056object[arrayPos0].priority = PRIORITY_XBOUNDS57temp0 = player[0].xpos58temp0 -= object[arrayPos0].xpos59Abs(temp0)60if temp0 < 0x20000061stage.curYBoundary2 = object[arrayPos0].iypos62stage.deathBoundary = object[arrayPos0].ypos63end if64else65object[arrayPos0].priority = PRIORITY_XBOUNDS66arrayPos1 = arrayPos067arrayPos1++68if player[0].ypos < object[arrayPos0].ypos69if player[0].ypos > object[arrayPos1].ypos70temp0 = player[0].xpos71temp0 -= object[arrayPos0].xpos72Abs(temp0)73if temp0 < 0x20000074stage.curYBoundary2 = object[arrayPos0].iypos75stage.deathBoundary = object[arrayPos0].ypos76end if77end if78end if79end if80else81object[arrayPos0].type = TypeName[Blank Object]82end if83next84end event858687// ========================88// Editor Events89// ========================9091event RSDKEdit92if editor.returnVariable == true93switch editor.variableID94case EDIT_VAR_PROPVAL // property value95case 0 // type96checkResult = object.propertyValue97break9899end switch100else101switch editor.variableID102case EDIT_VAR_PROPVAL // property value103case 0 // type104object.propertyValue = editor.variableValue105break106107end switch108end if109end event110111112event RSDKDraw113if editor.showGizmos == true114temp0 = object.xpos115temp0 -= 0x180000116temp1 = object.xpos117temp1 += 0x180000118DrawLine(temp0, object.ypos, temp1, object.ypos, 0xFF, 0xFF, 0x00) // No specific reason for using yellow, I just think it looks nice119end if120121// Draw the Y sprite ontop of the line122DrawSprite(0)123end event124125126event RSDKLoad127LoadSpriteSheet("Global/Display.gif")128SpriteFrame(-8, -8, 16, 16, 134, 18)129130AddEditorVariable("type")131SetActiveVariable("type")132AddEnumVariable("Regular Adjust", 0) // adjusts to this YPos133AddEnumVariable("Box Adjust", 1) // adjusts to this YPos, if the player is below this YPos and above the next object slots' YPos134135SetVariableAlias(ALIAS_VAR_VAL0, "leftBoundary") // only works on box adjust types136end event137138139