Path: blob/main/Scripts/Animals/R8_Bird.txt
1319 views
//----------------Sonic CD Flying Bird Script-----------------//1//--------Scripted by Christian Whitehead 'The Taxman'--------//2//-------Unpacked By Rubberduckycooly's Script Unpacker-------//34// Aliases5#alias Object.Value0 : Object.Timer6#alias Object.Value1 : Object.Angle78// HUD alias9#alias Object[24].PropertyValue : HUD.CurrentTimePeriod1011// States12#alias 0 : BIRD_FLYRIGHT13#alias 1 : BIRD_FLYLEFT1415// Time Period Aliases16#alias 2 : TIME_GOOD_FUTURE171819sub ObjectMain20switch Object.State21case BIRD_FLYRIGHT22if Object.Angle > 023Object.Angle -= 224else25// Apex reached, turn around26Object.State = BIRD_FLYLEFT27Object.Direction = FACING_LEFT28end if29break3031case BIRD_FLYLEFT32if Object.Angle < 25633Object.Angle += 234else35// Other side's apex reached, (re)turn once again36Object.State = BIRD_FLYRIGHT37Object.Direction = FACING_RIGHT38end if39break4041end switch4243// Animate the Bird44Object.Timer++45if Object.Timer > 1946Object.Timer = 047Object.Frame++48Object.Frame &= 149end if5051end sub525354sub ObjectDraw55if MetalSonic_Destroyed == true56Cos(TempValue0, Object.Angle)57TempValue0 <<= 1458TempValue0 += Object.XPos5960Sin(TempValue1, Object.Angle)61TempValue1 <<= 1462TempValue1 += Object.YPos6364DrawSpriteFX(Object.Frame, FX_FLIP, TempValue0, TempValue1)65else6667if HUD.CurrentTimePeriod == TIME_GOOD_FUTURE68Cos(TempValue0, Object.Angle)69TempValue0 <<= 1470TempValue0 += Object.XPos7172Sin(TempValue1, Object.Angle)73TempValue1 <<= 1474TempValue1 += Object.YPos7576DrawSpriteFX(Object.Frame, FX_FLIP, TempValue0, TempValue1)77end if7879end if8081end sub828384sub ObjectStartup85LoadSpriteSheet("R8/Objects2.gif")8687// Bird Frames8889SpriteFrame(-8, -8, 16, 16, 143, 110)90SpriteFrame(-8, -8, 16, 16, 143, 127)9192// Find all Flying Birds in the level93ArrayPos0 = 3294while ArrayPos0 < 105695if Object[ArrayPos0].Type == TypeName[Flying Bird]9697// Give the Bird a high Draw Order98// Birds should fly above everything else, after all99Object[ArrayPos0].DrawOrder = 5100101end if102103ArrayPos0++104loop105106end sub107108109// ========================110// Editor Subs111// ========================112113sub RSDKDraw114DrawSprite(0)115end sub116117118sub RSDKLoad119LoadSpriteSheet("R8/Objects2.gif")120SpriteFrame(-8, -8, 16, 16, 143, 110)121122SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")123end sub124125126