Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/R5/NoroNoro.txt
1319 views
1
//-----------------Sonic CD Noro Noro 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.Spikes
8
9
#alias Object.PropertyValue : Object.Quality
10
11
// States
12
#alias 0 : NORONORO_FINDGROUND
13
#alias 1 : NORONORO_ROLLLEFT
14
#alias 2 : NORONORO_ROLLRIGHT
15
16
// Gravity
17
#alias 1 : GRAVITY_AIR
18
19
// Stage SFX
20
#alias 1 : SFX_S_SPIKES
21
22
// Collision Sides
23
#alias 0 : CSIDE_FLOOR
24
25
// Badnik Quality / Property Values
26
#alias 0 : GOOD_QUALITY
27
#alias 1 : BAD_QUALITY
28
29
30
sub ObjectMain
31
32
// Firstly, animate the object
33
Object.Frame++
34
Object.Frame %= 60
35
36
switch Object.State
37
case NORONORO_FINDGROUND
38
39
// Check to see if the Noro Noro's on the floor
40
ObjectTileCollision(CSIDE_FLOOR, 0, 16, 0)
41
42
if CheckResult == true
43
// If it is, then advance states
44
Object.State = NORONORO_ROLLLEFT
45
else
46
// The Noro Noro's still in the air, so move down a pixel
47
Object.YPos += 0x10000
48
end if
49
break
50
51
case NORONORO_ROLLLEFT
52
53
// Roll 0.25 pixels left
54
Object.XPos -= 0x4000
55
56
Object.Timer--
57
if Object.Timer == -320
58
Object.State = NORONORO_ROLLRIGHT
59
Object.Direction = FACING_LEFT
60
end if
61
62
ObjectTileGrip(CSIDE_FLOOR, 0, 16, 0)
63
if CheckResult == 0
64
Object.State = NORONORO_ROLLRIGHT
65
Object.Timer = 0
66
Object.Direction = FACING_LEFT
67
end if
68
break
69
70
case NORONORO_ROLLRIGHT
71
Object.XPos += 0x4000
72
Object.Timer++
73
if Object.Timer == 320
74
Object.State = NORONORO_ROLLLEFT
75
Object.Direction = FACING_RIGHT
76
end if
77
78
ObjectTileGrip(CSIDE_FLOOR, 0, 16, 0)
79
if CheckResult == 0
80
Object.State = NORONORO_ROLLLEFT
81
Object.Timer = 0
82
Object.Direction = FACING_RIGHT
83
end if
84
break
85
86
end switch
87
88
CallFunction(StageSetup_CheckGoodFuture)
89
90
end sub
91
92
93
sub ObjectPlayerInteraction
94
95
// There's a small difference in interaction based on if the Player is in the air or not
96
// If in the air - Spikes are checked first, *then* the Noro Noro itself
97
// In on the ground - the Noro Noro is checked upon first, *then* Spikes are checked
98
99
// This only applies to Spikes Noro Noros, normal ones are just about the same regardless of the Player's aerial state
100
101
if Player.Gravity == GRAVITY_AIR
102
103
if Object.Quality == GOOD_QUALITY
104
// Spiked Noro Noro variant
105
106
// Make sure this Object hasn't been turned into a Flower yet
107
if Object.Type == TypeName[Noro Noro]
108
if Object.State > NORONORO_FINDGROUND
109
PlayerObjectCollision(C_TOUCH, -96, -256, 96, 256)
110
111
if CheckResult == true
112
if Object.Spikes == false
113
// If Spikes aren't already out, then play the SFX
114
PlayStageSfx(SFX_S_SPIKES, false)
115
end if
116
117
// Eject the Spikes!
118
Object.Spikes = true
119
else
120
// The Player's out of range, retract the Spikes for now...
121
Object.Spikes = false
122
end if
123
124
// Spikes hitbox
125
if Object.Spikes == true
126
PlayerObjectCollision(C_TOUCH, -8, -18, 8, -2)
127
128
if CheckResult == true
129
// Directly damage the Player
130
CallFunction(Player_Hit)
131
end if
132
end if
133
end if
134
end if
135
end if
136
137
// Normal Noro Noro hitbox
138
#platform: Use_Standalone
139
PlayerObjectCollision(C_TOUCH, -14, -14, 14, 14)
140
#endplatform
141
#platform: Use_Origins
142
PlayerObjectCollision(C_ENEMY, -14, -14, 14, 14)
143
#endplatform
144
if CheckResult == true
145
CallFunction(Player_BadnikBreak)
146
end if
147
else
148
149
// First, check the Noro Noro's hitbox
150
#platform: Use_Standalone
151
PlayerObjectCollision(C_TOUCH, -14, -14, 14, 14)
152
#endplatform
153
#platform: Use_Origins
154
PlayerObjectCollision(C_ENEMY, -14, -14, 14, 14)
155
#endplatform
156
if CheckResult == true
157
CallFunction(Player_BadnikBreak)
158
end if
159
160
if Object.Quality == GOOD_QUALITY
161
162
// Make sure the Noro Noro hasn't already been detroyed yet
163
if Object.Type == TypeName[Noro Noro]
164
if Object.State > NORONORO_FINDGROUND
165
PlayerObjectCollision(C_TOUCH, -96, -256, 96, 256)
166
167
if CheckResult == true
168
if Object.Spikes == false
169
// If Spikes aren't out already, then play the SFX for ejected the Spikes
170
PlayStageSfx(SFX_S_SPIKES, false)
171
end if
172
173
// Get the Spikes ready
174
Object.Spikes = true
175
else
176
// Bring the Spikes back in for now...
177
Object.Spikes = false
178
end if
179
180
// Check for the Spikes hitbox
181
if Object.Spikes == true
182
PlayerObjectCollision(C_TOUCH, -8, -18, 8, -2)
183
184
if CheckResult == true
185
CallFunction(Player_Hit)
186
end if
187
end if
188
end if
189
end if
190
end if
191
192
end if
193
194
end sub
195
196
197
sub ObjectDraw
198
if Object.Quality == GOOD_QUALITY
199
// Spikes Noro Noro
200
DrawSpriteFX(Object.Spikes, FX_FLIP, Object.XPos, Object.YPos)
201
else
202
// Normal Noro Noro
203
DrawSpriteFX(2, FX_FLIP, Object.XPos, Object.YPos)
204
end if
205
206
if Object.Frame > 29
207
DrawSpriteFX(3, FX_FLIP, Object.XPos, Object.YPos)
208
end if
209
end sub
210
211
212
sub ObjectStartup
213
LoadSpriteSheet("R5/Objects.gif")
214
215
// Noro Noro Frames
216
217
// Spikes Ejecting Frame
218
SpriteFrame(-16, -24, 32, 40, 1, 150)
219
220
// Spikes Ejected Frame
221
SpriteFrame(-16, -24, 32, 40, 34, 150)
222
223
// Spikes Retracted Frame
224
SpriteFrame(-16, -16, 32, 32, 66, 117)
225
226
// Blinking Frame
227
SpriteFrame(-16, -8, 16, 8, 67, 18)
228
229
end sub
230
231
232
// ========================
233
// Editor Subs
234
// ========================
235
236
sub RSDKEdit
237
if Editor.ReturnVariable == true
238
switch Editor.VariableID
239
case EDIT_VAR_PROPVAL // Property Value
240
CheckResult = Object.PropertyValue
241
break
242
case 0 // Type
243
CheckResult = Object.PropertyValue
244
break
245
end switch
246
else
247
switch Editor.VariableID
248
case EDIT_VAR_PROPVAL // Property Value
249
Object.PropertyValue = Editor.VariableValue
250
break
251
case 0 // Type
252
Object.PropertyValue = Editor.VariableValue
253
break
254
end switch
255
end if
256
end sub
257
258
259
sub RSDKDraw
260
DrawSprite(Object.PropertyValue)
261
end sub
262
263
264
sub RSDKLoad
265
LoadSpriteSheet("R5/Objects.gif")
266
SpriteFrame(-16, -24, 32, 40, 34, 150)
267
SpriteFrame(-16, -16, 32, 32, 66, 117)
268
269
AddEditorVariable("condition")
270
SetActiveVariable("condition")
271
AddEnumVariable("Good Quality", GOOD_QUALITY)
272
AddEnumVariable("Bad Quality", BAD_QUALITY)
273
end sub
274
275