Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-1-Sonic-2-2013-Script-Decompilation
Path: blob/master/Sonic 2/Scripts/Ending/Bird.txt
1479 views
1
// ----------------------------------
2
// RSDK Project: Sonic 2
3
// Script Description: Bird Object
4
// Script Author: Christian Whitehead/Simon Thomley
5
// Unpacked by Rubberduckycooly's script unpacker
6
// ----------------------------------
7
8
// ========================
9
// Aliases
10
// ========================
11
12
private alias object.value0 : object.timer
13
private alias object.value1 : object.startPos.y
14
private alias object.value2 : object.velStore.y
15
16
// States
17
private alias 0 : BIRD_SETUP
18
private alias 1 : BIRD_FLYIN
19
private alias 2 : BIRD_ENTERBIRD
20
private alias 3 : BIRD_FLYWITHPLANE
21
private alias 4 : BIRD_FLYOUT
22
23
// Player Aliases
24
private alias object.ypos : player.ypos
25
private alias 0 : SUPERSTATE_NONE
26
27
28
// ========================
29
// Events
30
// ========================
31
32
event ObjectUpdate
33
switch object.state
34
case BIRD_SETUP
35
Rand(object.xpos, 112)
36
object.xpos += -160
37
object.xpos <<= 16
38
39
Rand(object.ypos, 224)
40
object.ypos -= 112
41
object.ypos += camera[0].ypos
42
object.ypos <<= 16
43
if stage.playerListPos == PLAYER_TAILS_A
44
object.frame = 4
45
end if
46
47
if Player_superState != SUPERSTATE_NONE
48
object.frame = 2
49
end if
50
51
if object.ypos < player[0].ypos
52
object.yvel = 0x2000
53
else
54
object.yvel = -0x2000
55
end if
56
object.state = BIRD_FLYIN
57
break
58
59
case BIRD_FLYIN
60
object.timer--
61
if object.timer < 0
62
object.timer = 244
63
64
if object.ypos < player[0].ypos
65
object.ypos -= 0x68000
66
else
67
object.ypos += 0x68000
68
end if
69
70
object.state = BIRD_ENTERBIRD
71
end if
72
break
73
74
case BIRD_ENTERBIRD
75
object.xpos += 0x10000
76
object.ypos += object.yvel
77
78
object.timer--
79
if object.timer < 0
80
object.timer = 384
81
object.startPos.y = object.ypos
82
object.velStore.y = object.yvel
83
object.yvel = 0x8000
84
object.state = BIRD_FLYWITHPLANE
85
end if
86
break
87
88
case BIRD_FLYWITHPLANE
89
object.ypos += object.yvel
90
if object.ypos > object.startPos.y
91
object.yvel -= 0x400
92
else
93
object.yvel += 0x400
94
end if
95
96
object.timer--
97
if object.timer < 0
98
object.timer = 244
99
object.yvel = object.velStore.y
100
object.state = BIRD_FLYOUT
101
end if
102
break
103
104
case BIRD_FLYOUT
105
object.xpos -= 0x10000
106
object.ypos += object.yvel
107
108
object.timer--
109
if object.timer < 0
110
object.type = TypeName[Blank Object]
111
end if
112
break
113
114
end switch
115
116
// Animate the object
117
object.animationTimer++
118
if object.animationTimer == 6
119
object.animationTimer = 0
120
object.frame ^= 1
121
end if
122
end event
123
124
125
event ObjectDraw
126
DrawSpriteFX(object.frame, FX_FLIP, object.xpos, object.ypos)
127
end event
128
129
130
event ObjectStartup
131
LoadSpriteSheet("Global/Items2.gif")
132
133
// 0-1 - Blue Flicky Frames
134
SpriteFrame(-8, -7, 16, 15, 66, 239)
135
SpriteFrame(-8, -8, 16, 15, 83, 239)
136
137
// 2-3 - Eagle Frames
138
SpriteFrame(-8, -8, 16, 15, 32, 239)
139
SpriteFrame(-8, -7, 16, 15, 49, 239)
140
141
// 4-5 - Cucky Frames
142
SpriteFrame(-7, -8, 14, 16, 1, 239)
143
SpriteFrame(-7, -8, 15, 16, 16, 239)
144
end event
145
146
147
// ========================
148
// Editor Events
149
// ========================
150
151
event RSDKDraw
152
DrawSprite(0)
153
end event
154
155
156
event RSDKLoad
157
LoadSpriteSheet("Global/Items2.gif")
158
SpriteFrame(-8, -7, 16, 15, 66, 239)
159
160
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
161
end event
162
163