Path: blob/main/Scripts/Animals/R7_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 : FLYINGBIRD_FLYRIGHT13#alias 1 : FLYINGBIRD_FLYLEFT1415// Time Period Aliases16#alias 2 : TIME_GOOD_FUTURE171819sub ObjectMain2021// Note about the Object:22// It's always running and animating, regardless of the stage's current state,23// but it just hides itself in situations where it shouldn't show2425switch Object.State26case FLYINGBIRD_FLYRIGHT27if Object.Angle > 028Object.Angle -= 229else30// Hit the peak, turn around31Object.State = FLYINGBIRD_FLYLEFT32Object.Direction = FACING_LEFT33end if34break3536case FLYINGBIRD_FLYLEFT37if Object.Angle < 25638Object.Angle += 239else40// Hit the other side of the peak, turn right around again41Object.State = FLYINGBIRD_FLYRIGHT42Object.Direction = FACING_RIGHT43end if44break4546end switch474849// Animate the object50Object.Timer++51if Object.Timer > 1952Object.Timer = 053Object.Frame++54Object.Frame &= 155end if5657end sub585960sub ObjectDraw6162// Conditions for the Bird to show:63// Either have the Metal Sonic generator for the stage destroyed,64// or be in the Good Future of the Round6566if MetalSonic_Destroyed == true67Cos(TempValue0, Object.Angle)68TempValue0 <<= 1469TempValue0 += Object.XPos7071Sin(TempValue1, Object.Angle)72TempValue1 <<= 1473TempValue1 += Object.YPos7475DrawSpriteFX(Object.Frame, FX_FLIP, TempValue0, TempValue1)76else77if HUD.CurrentTimePeriod == TIME_GOOD_FUTURE78Cos(TempValue0, Object.Angle)79TempValue0 <<= 1480TempValue0 += Object.XPos8182Sin(TempValue1, Object.Angle)83TempValue1 <<= 1484TempValue1 += Object.YPos8586DrawSpriteFX(Object.Frame, FX_FLIP, TempValue0, TempValue1)87end if88end if8990end sub919293sub ObjectStartup94LoadSpriteSheet("R7/Objects.gif")9596// Bird Frames97SpriteFrame(-8, -8, 16, 16, 34, 186)98SpriteFrame(-8, -8, 16, 16, 34, 203)99100// Find all Flying Bird Objects in the stage101ArrayPos0 = 32102while ArrayPos0 < 1056103if Object[ArrayPos0].Type == TypeName[Flying Bird]104105// Set the Object's Draw Order to be above most other objects and the stage106Object[ArrayPos0].DrawOrder = 5107108end if109ArrayPos0++110loop111112end sub113114115// ========================116// Editor Subs117// ========================118119sub RSDKDraw120DrawSprite(0)121end sub122123124sub RSDKLoad125LoadSpriteSheet("R7/Objects.gif")126SpriteFrame(-8, -8, 16, 16, 34, 186)127128SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")129end sub130131132