Path: blob/main/Scripts/R1/FlipDoor.txt
1319 views
//-----------------Sonic CD Flip Door Script------------------//1//--------Scripted by Christian Whitehead 'The Taxman'--------//2//-------Unpacked By Rubberduckycooly's Script Unpacker-------//34// Aliases5#alias Object.Value0 : Object.Timer67// Stage SFX8#alias 4 : SFX_S_DOOR910// Property Values11#alias 0 : HORIZONTAL_DOOR12#alias 1 : VERTICAL_DOOR131415sub ObjectPlayerInteraction16if Object.PropertyValue == HORIZONTAL_DOOR17PlayerObjectCollision(C_PLATFORM, -24, -4, 24, 32)18PlayerObjectCollision(C_TOUCH, -24, -8, 24, 8)19if CheckResult == true20if Player.YPos > Object.YPos21if Object.Timer == 022PlayStageSfx(SFX_S_DOOR, 0)23end if2425Object.Timer = 1026end if27end if28else29if Player.XPos < Object.XPos30PlayerObjectCollision(C_TOUCH, -16, -24, 0, 24)31if CheckResult == true32if Object.Timer == 033PlayStageSfx(SFX_S_DOOR, 0)34end if3536Object.Timer = 1037end if38else39if Object.Timer == 040PlayerObjectCollision(C_BOX, -24, -24, 4, 24)41end if42end if43end if44end sub454647sub ObjectDraw48if Object.PropertyValue == HORIZONTAL_DOOR49if Object.Timer > 050DrawSprite(1)51Object.Timer--52else53DrawSprite(0)54end if55else56if Object.Timer > 057DrawSprite(3)58Object.Timer--59else60DrawSprite(2)61end if62end if63end sub646566sub ObjectStartup67LoadSpriteSheet("R1/Objects.gif")6869SpriteFrame(-24, -4, 48, 8, 117, 34) // #0 - Flip Door Horizontal70SpriteFrame(-24, -44, 8, 48, 167, 43) // #1 - Flip Door Horizontal Open71SpriteFrame(-4, -24, 8, 48, 176, 43) // #2 - Flip Door Vertical72SpriteFrame(-4, -24, 48, 8, 117, 34) // #3 - Flip Door Vertical Open7374ArrayPos0 = 3275while ArrayPos0 < 105676if Object[ArrayPos0].Type == TypeName[Flip Door]77Object[ArrayPos0].DrawOrder = 578end if79ArrayPos0++80loop81end sub828384// ========================85// Editor Subs86// ========================8788sub RSDKEdit89if Editor.ReturnVariable == true90switch Editor.VariableID91case EDIT_VAR_PROPVAL // Property Value92CheckResult = Object.PropertyValue93CheckResult &= 194break95case 0 // orientation96CheckResult = Object.PropertyValue97CheckResult &= 198break99end switch100else101switch Editor.VariableID102case EDIT_VAR_PROPVAL // Property Value103Object.PropertyValue = Editor.VariableValue104Object.PropertyValue &= 1105break106case 0 // orientation107Object.PropertyValue = Editor.VariableValue108Object.PropertyValue &= 1109break110end switch111end if112end sub113114115sub RSDKDraw116DrawSprite(Object.PropertyValue)117end sub118119120sub RSDKLoad121LoadSpriteSheet("R1/Objects.gif")122123SpriteFrame(-24, -4, 48, 8, 117, 34) // #0 - Flip Door Horizontal124SpriteFrame(-4, -24, 8, 48, 176, 43) // #1 - Flip Door Vertical125126127AddEditorVariable("orientation")128SetActiveVariable("orientation")129AddEnumVariable("Horizontal", 0)130AddEnumVariable("Vertical", 1)131end sub132133134