Path: blob/main/Scripts/Players/TailsObject.txt
1319 views
//----------------Sonic CD Tails Object Script----------------//1//--------Scripted by Christian Whitehead 'The Taxman'--------//2//-------Unpacked By Rubberduckycooly's Script Unpacker-------//34// Aliases5#alias Object.Value1 : Object.TailAnimation6#alias Object[1].DrawOrder : TailsObject.DrawOrder7#alias Object[1].Priority : TailsObject.Priority89#alias 1 : PRIORITY_ACTIVE1011// Animation Aliases12// Because the ANI_* variables are, well, variables, we can't use them as cases in a switch-case statement, so let's make our own version of them here so that we can do that13#alias 0 : TAILS_STOPPED14#alias 1 : TAILS_WAITING15#alias 3 : TAILS_LOOKING_UP16#alias 4 : TAILS_LOOKING_DOWN17#alias 7 : TAILS_SKIDDING18#alias 9 : TAILS_SPIN_DASH19#alias 10 : TAILS_JUMPING20#alias 17 : TAILS_PUSHING21#alias 43 : TAILS_ROLL3D2223// Player aliases24#alias 1 : PLAYER_TAILS_A252627sub ObjectMain28ArrayPos0 = Player.DrawOrder29Screen[ArrayPos0].DrawListSize = 230GetDrawListEntityRef(TempValue0, ArrayPos0, 0)31SetDrawListEntityRef(Object.EntityNo, ArrayPos0, 0)32SetDrawListEntityRef(TempValue0, ArrayPos0, 1)33end sub343536sub ObjectDraw37if Object.TailAnimation != Player.Animation38if Player.Animation > 439Object.Frame = 040end if4142if Object.TailAnimation > 443Object.Frame = 044end if4546Object.TailAnimation = Player.Animation47end if4849Object.Direction = Player.Direction50switch Object.TailAnimation51case TAILS_STOPPED52if Player.Frame == 053TempValue0 = Object.Frame54TempValue0 >>= 35556if Player.Visible == true57DrawSpriteFX(TempValue0, FX_FLIP, Player.XPos, Player.YPos)58end if5960Object.Frame++61Object.Frame %= 4062end if63break6465case TAILS_WAITING66case TAILS_LOOKING_UP67case TAILS_LOOKING_DOWN68TempValue0 = Object.Frame69TempValue0 >>= 37071if Player.Visible == true72DrawSpriteFX(TempValue0, FX_FLIP, Player.XPos, Player.YPos)73end if7475Object.Frame++76Object.Frame %= 4077break7879case TAILS_SKIDDING80case TAILS_SPIN_DASH81TempValue0 = Object.Frame82TempValue0 >>= 283TempValue0 += 118485if Player.Visible == true86DrawSpriteFX(TempValue0, FX_FLIP, Player.XPos, Player.YPos)87end if8889Object.Frame++90Object.Frame %= 1291break9293case TAILS_JUMPING94case TAILS_ROLL3D95TempValue0 = Object.Frame96TempValue0 >>= 29798CheckEqual(Player.XVelocity, 0)99TempValue1 = CheckResult100CheckEqual(Player.YVelocity, 0)101TempValue1 &= CheckResult102if TempValue1 == false103ATan2(Object.Rotation, Player.XVelocity, Player.YVelocity)104Object.Rotation += 16105Object.Rotation &= 255106Object.Rotation >>= 5107// Rotates the tails according to Tails's rotation108switch Object.Rotation109case 0110case 8111TempValue0 += 5112Object.Rotation = 0113break114115case 1116TempValue0 += 8117if Object.Direction == FACING_RIGHT118Object.Rotation = 64119else120Object.Rotation = 0121end if122break123124case 2125TempValue0 += 5126Object.Rotation = 64127break128129case 3130TempValue0 += 8131if Object.Direction == FACING_RIGHT132Object.Rotation = 128133else134Object.Rotation = 64135end if136break137138case 4139TempValue0 += 5140Object.Rotation = 128141break142143case 5144TempValue0 += 8145if Object.Direction == FACING_RIGHT146Object.Rotation = 192147else148Object.Rotation = 128149end if150break151152case 6153TempValue0 += 5154Object.Rotation = 192155break156157case 7158TempValue0 += 8159if Object.Direction == FACING_RIGHT160Object.Rotation = 0161else162Object.Rotation = 192163end if164break165end switch166167if Object.Direction == FACING_LEFT168Object.Rotation += 128169end if170else171TempValue0 += 5172Object.Rotation = 0173end if174175Object.Rotation <<= 1176177if Player.Visible == true178DrawSpriteFX(TempValue0, FX_ROTATE, Player.XPos, Player.YPos)179end if180181Object.Frame++182Object.Frame %= 12183break184185case TAILS_PUSHING186TempValue0 = Object.Frame187TempValue0 /= 10188TempValue0 += 11189190if Player.Visible == true191DrawSpriteFX(TempValue0, FX_FLIP, Player.XPos, Player.YPos)192end if193194Object.Frame++195Object.Frame %= 30196break197end switch198end sub199200201sub ObjectStartup202if Stage.PlayerListPos == PLAYER_TAILS_A // PLAYER_TAILS in origins203LoadSpriteSheet("Players/Tails1.gif")204205Object[1].Type = TypeName[Tails Object]206TailsObject.DrawOrder = 8207TailsObject.Priority = PRIORITY_ACTIVE208209// Idle Frames210SpriteFrame(-22, -8, 16, 24, 82, 199) // #0 - Tail Idle Frame 0211SpriteFrame(-26, -8, 20, 24, 99, 199) // #1 - Tail Idle Frame 1212SpriteFrame(-26, -8, 20, 24, 120, 199) // #2 - Tail Idle Frame 2213SpriteFrame(-26, -8, 20, 24, 141, 199) // #3 - Tail Idle Frame 3214SpriteFrame(-26, -8, 20, 24, 162, 199) // #4 - Tail Idle Frame 4215216// Rolling Frames217SpriteFrame(-35, -8, 24, 16, 231, 166) // #5 - Tail Rolling Frame 0218SpriteFrame(-35, -8, 24, 16, 231, 183) // #6 - Tail Rolling Frame 1219SpriteFrame(-35, -8, 24, 16, 231, 200) // #7 - Tail Rolling Frame 2220221// Jumping Frames222SpriteFrame(-25, 9, 20, 16, 235, 217) // #8 - Tail Jumping Frame 0223SpriteFrame(-25, 9, 18, 16, 237, 234) // #9 - Tail Jumping Frame 1224SpriteFrame(-25, 9, 20, 16, 216, 234) // #10 - Tail Jumping Frame 2225SpriteFrame(-30, -6, 24, 16, 231, 166) // #11 - Tail Jumping Frame 3226SpriteFrame(-30, -6, 24, 16, 231, 183) // #12 - Tail Jumping Frame 4227SpriteFrame(-30, -6, 24, 16, 231, 200) // #13 - Tail Jumping Frame 5228end if229end sub230231232// ========================233// Editor Subs234// ========================235236sub RSDKDraw237DrawSprite(0)238end sub239240241sub RSDKLoad242LoadSpriteSheet("Players/Tails1.gif")243SpriteFrame(-22, -8, 16, 24, 82, 199) // Tail Idle Frame 0244245SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")246end sub247248249