Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/Animals/BlueBird.txt
1319 views
1
//------------------Sonic CD Blue 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 : BLUEBIRD_FLYRIGHT
14
#alias 1 : BLUEBIRD_FLYLEFT
15
16
// Time Period Aliases
17
#alias 2 : TIME_GOOD_FUTURE
18
19
20
sub ObjectMain
21
// This Object is always running & updating, regardless of the Stage's current state
22
// However, it will only draw itself under the specific conditions, though it is being
23
// updated all the same
24
25
switch Object.State
26
case BLUEBIRD_FLYRIGHT
27
if Object.Angle > 0
28
Object.Angle -= 2
29
else
30
// Apex hit, turn around
31
32
Object.State = BLUEBIRD_FLYLEFT
33
Object.Direction = FACING_LEFT
34
end if
35
break
36
37
case BLUEBIRD_FLYLEFT
38
if Object.Angle < 256
39
Object.Angle += 2
40
else
41
// Other apex hit now, return to the other direction
42
43
Object.State = BLUEBIRD_FLYRIGHT
44
Object.Direction = FACING_RIGHT
45
end if
46
break
47
48
end switch
49
50
// Animate the Blue Bird
51
Object.Timer++
52
if Object.Timer > 19
53
Object.Timer = 0
54
55
Object.Frame++
56
57
// The Bird bounces between 2 frames total
58
Object.Frame &= 1
59
end if
60
61
end sub
62
63
64
sub ObjectDraw
65
if MetalSonic_Destroyed == true
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
77
if HUD.CurrentTimePeriod == TIME_GOOD_FUTURE
78
Cos(TempValue0, Object.Angle)
79
TempValue0 <<= 14
80
TempValue0 += Object.XPos
81
82
Sin(TempValue1, Object.Angle)
83
TempValue1 <<= 14
84
TempValue1 += Object.YPos
85
86
DrawSpriteFX(Object.Frame, FX_FLIP, TempValue0, TempValue1)
87
end if
88
end sub
89
90
91
sub ObjectStartup
92
LoadSpriteSheet("Global/Items3.gif")
93
94
SpriteFrame(-8, -8, 16, 16, 240, 199)
95
SpriteFrame(-8, -8, 16, 16, 240, 216)
96
end sub
97
98
99
// ========================
100
// Editor Subs
101
// ========================
102
103
sub RSDKDraw
104
DrawSprite(0)
105
end sub
106
107
108
sub RSDKLoad
109
LoadSpriteSheet("Global/Items3.gif")
110
SpriteFrame(-8, -8, 16, 16, 240, 199)
111
112
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
113
end sub
114
115