Path: blob/main/Scripts/R3/Blade.txt
1319 views
//--------------Sonic CD Kama Kama Blade Script---------------//1//--------Scripted by Christian Whitehead 'The Taxman'--------//2//-------Unpacked By Rubberduckycooly's Script Unpacker-------//34// Aliases5#alias Object.Value0 : Object.XVelocity6#alias Object.Value1 : Object.YVelocity7#alias Object.Value2 : Object.KamaKamaEntityNo8#alias Object.PropertyValue : Object.LaunchTimer910// States11#alias 0 : BLADE_LAUNCH12#alias 1 : BLADE_BLANK13#alias 2 : BLADE_DEFLECTED1415// Stage SFX16#alias 5 : SFX_S_BLADES171819sub ObjectMain20Object.XPos += Object.XVelocity21Object.YPos += Object.YVelocity2223Object.Frame++24Object.Frame %= 242526switch Object.State27case BLADE_LAUNCH28ArrayPos0 = Object.KamaKamaEntityNo29// if the Kama Kama that launched this is destroyed, destroy the blade30if Object[ArrayPos0].Type != TypeName[Kama Kama]31Object.Type = TypeName[Blank Object]32end if3334if Object.LaunchTimer > 035Object.LaunchTimer--36else37Object.State = BLADE_BLANK38PlayStageSfx(SFX_S_BLADES, false)39if Object.Direction == FACING_RIGHT40Object.XVelocity = -0x3000041else42Object.XVelocity = 0x3000043end if44end if45break4647case BLADE_DEFLECTED48Object.YVelocity += 0x300049break5051end switch5253if Object.OutOfBounds == true54Object.Type = TypeName[Blank Object]55else56TempValue0 = Screen.YOffset57TempValue0 -= 858TempValue0 <<= 1659if Object.YPos < TempValue060Object.Type = TypeName[Blank Object]61end if6263end if64end sub656667sub ObjectPlayerInteraction68if Object.State == BLADE_BLANK69PlayerObjectCollision(C_TOUCH, -8, -6, 8, 6)70if CheckResult == true71// Check if the blades will bounce on the player72CheckEqual(Player.Animation, ANI_JUMPING)73TempValue0 = CheckResult74CheckEqual(Player.Animation, ANI_SPINDASH)75TempValue0 |= CheckResult7677if TempValue0 == true78Object.State = BLADE_DEFLECTED7980Object.YVelocity = -0x8000081if Object.Direction == FACING_RIGHT82if Player.XVelocity > 0x800083FlipSign(Object.XVelocity)84end if85else86if Player.XVelocity < -0x800087FlipSign(Object.XVelocity)88end if89end if90else91CallFunction(Player_Hit)92end if93end if94end if95end sub969798sub ObjectDraw99TempValue0 = Object.Frame100TempValue0 >>= 2101DrawSpriteFX(TempValue0, FX_FLIP, Object.XPos, Object.YPos)102end sub103104105sub ObjectStartup106LoadSpriteSheet("R3/Objects.gif")107108SpriteFrame(-8, -8, 16, 16, 198, 68) // #0 - Blade Frame 0109SpriteFrame(-8, -8, 16, 16, 215, 68) // #1 - Blade Frame 1110SpriteFrame(-8, -8, 16, 16, 232, 68) // #2 - Blade Frame 2111SpriteFrame(-8, -8, 16, 16, 198, 85) // #3 - Blade Frame 3112SpriteFrame(-8, -8, 16, 16, 215, 85) // #4 - Blade Frame 4113SpriteFrame(-8, -8, 16, 16, 232, 85) // #5 - Blade Frame 5114end sub115116117// ========================118// Editor Subs119// ========================120121sub RSDKDraw122DrawSprite(0)123end sub124125126sub RSDKLoad127LoadSpriteSheet("R3/Objects.gif")128129SpriteFrame(-8, -8, 16, 16, 198, 68) // #0 - Blade130131SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")132end sub133134135