0% found this document useful (0 votes)
85 views3 pages

Sonic CD Flying Bird Script Guide

This document contains the script for a flying bird object in Sonic CD. It defines states for flying right and left, animates the bird by changing its angle and frame, and conditions for when to draw the bird based on the stage's time period or if the Metal Sonic generator is destroyed. It also contains initialization code to load sprite frames and find existing bird objects in the stage.

Uploaded by

Lucas Da Web95
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
85 views3 pages

Sonic CD Flying Bird Script Guide

This document contains the script for a flying bird object in Sonic CD. It defines states for flying right and left, animates the bird by changing its angle and frame, and conditions for when to draw the bird based on the stage's time period or if the Metal Sonic generator is destroyed. It also contains initialization code to load sprite frames and find existing bird objects in the stage.

Uploaded by

Lucas Da Web95
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

//---------------Sonic CD Flying Bird Script------------------//

//--------Scripted by Christian Whitehead 'The Taxman'--------//


//-------Unpacked By Rubberduckycooly's Script Unpacker-------//

// Aliases
#alias Object.Value0 : Object.Timer
#alias Object.Value1 : Object.Angle

// HUD alias
#alias Object[24].PropertyValue : HUD.CurrentTimePeriod

// States
#alias 0 : FLYINGBIRD_FLYRIGHT
#alias 1 : FLYINGBIRD_FLYLEFT

// Time Period Aliases


#alias 2 : TIME_GOOD_FUTURE

sub ObjectMain

// Note about the Object:


// It's always running and animating, regardless of the stage's current
state,
// but it just hides itself in situations where it shouldn't show

switch Object.State
case FLYINGBIRD_FLYRIGHT
if Object.Angle > 0
Object.Angle -= 2
else
// Hit the peak, turn around
Object.State = FLYINGBIRD_FLYLEFT
Object.Direction = FACING_LEFT
end if
break

case FLYINGBIRD_FLYLEFT
if Object.Angle < 256
Object.Angle += 2
else
// Hit the other side of the peak, turn right around again
Object.State = FLYINGBIRD_FLYRIGHT
Object.Direction = FACING_RIGHT
end if
break

end switch

// Animate the object


Object.Timer++
if Object.Timer > 19
Object.Timer = 0
Object.Frame++
Object.Frame &= 1
end if

end sub
sub ObjectDraw

// Conditions for the Bird to show:


// Either have the Metal Sonic generator for the stage destroyed,
// or be in the Good Future of the Round

if MetalSonic_Destroyed == true
Cos(TempValue0, Object.Angle)
TempValue0 <<= 14
TempValue0 += Object.XPos

Sin(TempValue1, Object.Angle)
TempValue1 <<= 14
TempValue1 += Object.YPos

DrawSpriteFX(Object.Frame, FX_FLIP, TempValue0, TempValue1)


else
if HUD.CurrentTimePeriod == TIME_GOOD_FUTURE
Cos(TempValue0, Object.Angle)
TempValue0 <<= 14
TempValue0 += Object.XPos

Sin(TempValue1, Object.Angle)
TempValue1 <<= 14
TempValue1 += Object.YPos

DrawSpriteFX(Object.Frame, FX_FLIP, TempValue0, TempValue1)


end if
end if

end sub

sub ObjectStartup
LoadSpriteSheet("R7/Objects.gif")

// Bird Frames
SpriteFrame(-8, -8, 16, 16, 34, 186)
SpriteFrame(-8, -8, 16, 16, 34, 203)

// Find all Flying Bird Objects in the stage


ArrayPos0 = 32
while ArrayPos0 < 1056
if Object[ArrayPos0].Type == TypeName[Flying Bird]

// Set the Object's Draw Order to be above most other objects and
the stage
Object[ArrayPos0].DrawOrder = 5

end if
ArrayPos0++
loop

end sub

// ========================
// Editor Subs
// ========================

sub RSDKDraw
DrawSprite(0)
end sub

sub RSDKLoad
LoadSpriteSheet("R7/Objects.gif")
SpriteFrame(-8, -8, 16, 16, 34, 186)

SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
end sub

You might also like