Path: blob/main/Scripts/R8/Forcefield.txt
1319 views
//------------------Sonic CD Forcefield Script----------------//1//--------Scripted by Christian Whitehead 'The Taxman'--------//2//-------Unpacked By Rubberduckycooly's Script Unpacker-------//34// Aliases5#alias Object.PropertyValue : Object.ScrollDistance67// States8#alias 0 : FORCEFIELD_MOVE_TO_SCREEN9#alias 1 : FORCEFIELD_IDLE10#alias 2 : FORCEFIELD_VANISH1112// Ink Effects13#alias 2 : INK_ALPHA141516sub ObjectMain17switch Object.State18case FORCEFIELD_MOVE_TO_SCREEN19if Object.ScrollDistance > 16820Object.ScrollDistance--21else22Object.State++23end if2425Object.Frame = Object.AnimationTimer26Object.Frame >>= 22728Object.AnimationTimer++29Object.AnimationTimer &= 153031TempValue1 = Oscillation32TempValue1 <<= 333Sin(TempValue0, TempValue1)34TempValue0 >>= 435TempValue0 += 1903637Object.Alpha = TempValue038Object.InkEffect = INK_ALPHA39Object.DrawOrder = 440break4142case FORCEFIELD_IDLE43Object.Frame = Object.AnimationTimer44Object.Frame >>= 24546Object.AnimationTimer++47Object.AnimationTimer &= 154849TempValue1 = Oscillation50TempValue1 <<= 351Sin(TempValue0, TempValue1)52TempValue0 >>= 453TempValue0 += 1905455Object.Alpha = TempValue056break5758case FORCEFIELD_VANISH59Object.Frame = 060if Object.Alpha > 061Object.Alpha -= 262end if63break64end switch65end sub666768sub ObjectPlayerInteraction69if Object.Alpha > 070TempValue0 = Object.ScrollDistance71TempValue0 -= 872PlayerObjectCollision(C_BOX, TempValue0, -96, 240, 96)73FlipSign(TempValue0)74PlayerObjectCollision(C_BOX, -240, -96, TempValue0, 96)75end if76end sub777879sub ObjectDraw80TempValue0 = Object.ScrollDistance81TempValue0 *= -0x1000082TempValue0 += Object.XPos83DrawSpriteFX(4, FX_INK, TempValue0, Object.YPos)84DrawSpriteFX(5, FX_INK, TempValue0, Object.YPos)8586Object.Direction = FACING_RIGHT87DrawSpriteFX(Object.Frame, FX_FLIP, TempValue0, Object.YPos)88Object.Direction = 289DrawSpriteFX(Object.Frame, FX_FLIP, TempValue0, Object.YPos)9091TempValue0 = Object.ScrollDistance92TempValue0 <<= 1693TempValue0 += Object.XPos94DrawSpriteFX(4, FX_INK, TempValue0, Object.YPos)95DrawSpriteFX(5, FX_INK, TempValue0, Object.YPos)9697Object.Direction = FACING_RIGHT98DrawSpriteFX(Object.Frame, FX_FLIP, TempValue0, Object.YPos)99Object.Direction = 2100DrawSpriteFX(Object.Frame, FX_FLIP, TempValue0, Object.YPos)101end sub102103104sub ObjectStartup105LoadSpriteSheet("R8/Objects3.gif")106107SpriteFrame(-8, 80, 16, 16, 90, 35) // #0 - Forcefield machine frame 0108SpriteFrame(-8, 80, 16, 16, 107, 35) // #1 - Forcefield machine frame 1109SpriteFrame(-8, 80, 16, 16, 124, 35) // #2 - Forcefield machine frame 2110SpriteFrame(-8, 80, 16, 16, 107, 35) // #3 - Forcefield machine frame 3111112SpriteFrame(-8, -82, 16, 82, 74, 114) // #4 - Forcefield Beam frame 0113SpriteFrame(-8, 0, 16, 82, 74, 114) // #5 - Forcefield Beam frame 1114end sub115116117// ========================118// Editor Subs119// ========================120121sub RSDKDraw122TempValue0 = 168123TempValue0 *= -0x10000124TempValue0 += Object.XPos125DrawSpriteFX(1, FX_INK, TempValue0, Object.YPos)126DrawSpriteFX(2, FX_INK, TempValue0, Object.YPos)127128Object.Direction = FACING_RIGHT129DrawSpriteFX(0, FX_FLIP, TempValue0, Object.YPos)130Object.Direction = 2131DrawSpriteFX(0, FX_FLIP, TempValue0, Object.YPos)132133TempValue0 = 168134TempValue0 <<= 16135TempValue0 += Object.XPos136DrawSpriteFX(1, FX_INK, TempValue0, Object.YPos)137DrawSpriteFX(2, FX_INK, TempValue0, Object.YPos)138139Object.Direction = FACING_RIGHT140DrawSpriteFX(0, FX_FLIP, TempValue0, Object.YPos)141Object.Direction = 2142DrawSpriteFX(0, FX_FLIP, TempValue0, Object.YPos)143end sub144145146sub RSDKLoad147LoadSpriteSheet("R8/Objects3.gif")148149SpriteFrame(-8, 80, 16, 16, 90, 35) // #0 - Forcefield machine frame 0150151SpriteFrame(-8, -82, 16, 82, 74, 114) // #1 - Forcefield Beam frame 0152SpriteFrame(-8, 0, 16, 82, 74, 114) // #2 - Forcefield Beam frame 1153154SetVariableAlias(ALIAS_VAR_PROPVAL, "scrollDistance")155end sub156157158