Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/Animals/R3_Bird.txt
1319 views
1
//------------------Sonic CD Flying Bird Script---------------//
2
//--------Scripted by Christian Whitehead 'The Taxman'--------//
3
//-------Unpacked By Rubberduckycooly's Script Unpacker-------//
4
5
// Aliases
6
#alias Object.Value0 : Object.Timer
7
#alias Object.Value1 : Object.Angle
8
9
// HUD alias
10
#alias Object[24].PropertyValue : HUD.CurrentTimePeriod
11
12
// States
13
#alias 0 : BIRD_FLYRIGHT
14
#alias 1 : BIRD_FLYLEFT
15
16
// Time Period Aliases
17
#alias 2 : TIME_GOOD_FUTURE
18
19
20
sub ObjectMain
21
switch Object.State
22
case BIRD_FLYRIGHT
23
if Object.Angle > 0
24
Object.Angle -= 2
25
else
26
Object.State = BIRD_FLYLEFT
27
Object.Direction = FACING_LEFT
28
end if
29
break
30
31
case BIRD_FLYLEFT
32
if Object.Angle < 256
33
Object.Angle += 2
34
else
35
Object.State = BIRD_FLYRIGHT
36
Object.Direction = FACING_RIGHT
37
end if
38
break
39
40
end switch
41
42
// Animate the Bird
43
Object.Timer++
44
if Object.Timer > 3
45
Object.Timer = 0
46
Object.Frame++
47
Object.Frame &= 1
48
end if
49
50
end sub
51
52
53
sub ObjectDraw
54
if MetalSonic_Destroyed == true
55
Cos(TempValue0, Object.Angle)
56
TempValue0 <<= 14
57
TempValue0 += Object.XPos
58
59
Sin(TempValue1, Object.Angle)
60
TempValue1 <<= 14
61
TempValue1 += Object.YPos
62
63
DrawSpriteFX(Object.Frame, FX_FLIP, TempValue0, TempValue1)
64
else
65
if HUD.CurrentTimePeriod == TIME_GOOD_FUTURE
66
Cos(TempValue0, Object.Angle)
67
TempValue0 <<= 14
68
TempValue0 += Object.XPos
69
70
Sin(TempValue1, Object.Angle)
71
TempValue1 <<= 14
72
TempValue1 += Object.YPos
73
74
DrawSpriteFX(Object.Frame, FX_FLIP, TempValue0, TempValue1)
75
end if
76
end if
77
78
end sub
79
80
81
sub ObjectStartup
82
83
LoadSpriteSheet("R3/Objects3.gif")
84
85
SpriteFrame(-8, -8, 16, 16, 132, 1)
86
SpriteFrame(-8, -8, 16, 16, 132, 18)
87
88
// Setup all Flying Bird Objects in the level
89
ArrayPos0 = 32
90
while ArrayPos0 < 1056
91
if Object[ArrayPos0].Type == TypeName[Flying Bird]
92
93
// Give all Bird a high Draw Order so that they're above most other Objects
94
// & stage tiles
95
Object[ArrayPos0].DrawOrder = 5
96
97
end if
98
99
ArrayPos0++
100
loop
101
102
end sub
103
104
105
// ========================
106
// Editor Subs
107
// ========================
108
109
sub RSDKDraw
110
DrawSprite(0)
111
end sub
112
113
114
sub RSDKLoad
115
LoadSpriteSheet("R3/Objects3.gif")
116
SpriteFrame(-8, -8, 16, 16, 132, 1)
117
118
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
119
end sub
120
121