Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/R7/Eggman.txt
1319 views
1
//-------------------Sonic CD Eggman Script-------------------//
2
//--------Scripted by Christian Whitehead 'The Taxman'--------//
3
//-------Unpacked By Rubberduckycooly's Script Unpacker-------//
4
5
// Note: We're using R7Eggman as a prefix here because there's like 5 "Eggman" objects in the game, it's less confusing this way
6
7
// Aliases
8
#alias Object.Value0 : Object.Timer
9
#alias Object.Value1 : Object.XVelocity
10
#alias Object.Value2 : Object.LaserActive
11
#alias Object.Value3 : Object.DebrisTimer
12
#alias Object.Value4 : Object.LastExplosion
13
#alias Object.Value5 : Object.LaserOffset
14
#alias Object.Value6 : Object.Acceleration
15
16
// HUD Alias
17
#alias Object[24].PropertyValue : HUD.CurrentTimePeriod
18
19
// Initial few States
20
#alias 0 : R7EGGMAN_AWAITPLAYER
21
#alias 1 : R7EGGMAN_WAIT
22
23
// Flying across the Screen, Right -> Left, then Left -> Right
24
#alias 2 : R7EGGMAN_FLYIN_RL
25
#alias 3 : R7EGGMAN_FLYIN_LR
26
27
// Some States for taking care of Metal
28
#alias 4 : R7EGGMAN_GOTOMETAL
29
#alias 5 : R7EGGMAN_STARTUPMETAL
30
31
// A bunch of small States for when he's flashing the laser on and off
32
#alias 6 : R7EGGMAN_INTROLASERON1
33
#alias 7 : R7EGGMAN_INTROLASEROFF1
34
#alias 8 : R7EGGMAN_INTROLASERON2
35
#alias 9 : R7EGGMAN_INTROLASEROFF2
36
#alias 10 : R7EGGMAN_INTROLASERON3
37
#alias 11 : R7EGGMAN_INTROLASEROFF3
38
39
// Chasing the pair of Blues during the race
40
#alias 12 : R7EGGMAN_CHASESTART
41
#alias 13 : R7EGGMAN_CHASEMAIN
42
43
// After the race, a series of states for him repeatedly lasering Metal Sonic's scrapped remains (?)
44
#alias 14 : R7EGGMAN_ENDLASERON1
45
#alias 15 : R7EGGMAN_ENDLASEROFF1
46
#alias 16 : R7EGGMAN_ENDLASERON2
47
#alias 17 : R7EGGMAN_ENDLASEROFF2
48
#alias 18 : R7EGGMAN_ENDLASERON3
49
#alias 19 : R7EGGMAN_ENDLASEROFF3
50
51
// After that fit, now he descends and flies off to the right
52
#alias 20 : R7EGGMAN_DESCEND
53
#alias 21 : R7EGGMAN_PAUSE
54
#alias 22 : R7EGGMAN_FLYAWAY
55
56
// Thruster Animations
57
#alias 0 : R7EGGMANANI_THRUSTEROFF
58
#alias 1 : R7EGGMANANI_THRUSTERON
59
60
// Metal Sonic (Object[+1]) Aliases
61
#alias 1 : METALSONIC_TURNRIGHT
62
63
#alias 2 : ANI_TURNING
64
65
// Vertical Door (Object [-2] and [-1]) Aliases
66
#alias Object.Value0 : Object.DrawPosY
67
68
#alias 1 : VERTICALDOOR_START_OPENING
69
#alias 3 : VERTICALDOOR_END_OPENED
70
71
// Object[-2] is the door at the start of the race, [-1] is the final door
72
73
// Debris Aliases
74
// (XVel is coincidentally the same value as the main Eggman object so it doesn't need to be redeclared here)
75
#alias Object.Value2 : Object.YVelocity
76
77
// Fade Music Aliases
78
#alias 0 : FADEMUSIC_FADE_TO_BOSS
79
#alias 1 : FADEMUSIC_FADE_TO_LEVEL
80
#alias 2 : FADEMUSIC_SSZEGGMAN
81
82
// Soundtrack
83
#alias 0 : OST_JP
84
85
// Collision Sides
86
#alias 0 : CSIDE_FLOOR
87
88
// Priority
89
#alias 0 : PRIORITY_BOUNDS
90
#alias 1 : PRIORITY_ACTIVE
91
92
// Time Periods
93
#alias 2 : TIME_GOOD_FUTURE
94
95
96
// Function declarations
97
#function R7Eggman_FollowGround
98
99
100
function R7Eggman_FollowGround
101
// The track has all sorts of curves and ramps and stairs and such, this function is called to make Robotnik trace them
102
103
// First move Robotnik 32 pixels up and attempt to find ground
104
Object.YPos -= 0x200000
105
ObjectTileGrip(CSIDE_FLOOR, 6, 176, 0)
106
if CheckResult == false
107
108
// No ground was found, so move Robotnik 16 pixels down and try again
109
Object.YPos += 0x100000
110
ObjectTileGrip(CSIDE_FLOOR, 6, 176, 0)
111
if CheckResult == false
112
113
// Still no collision, try once more
114
Object.YPos += 0x100000
115
ObjectTileGrip(CSIDE_FLOOR, 6, 176, 0)
116
if CheckResult == false
117
118
// Give up - move Robotnik but don't try to follow the ground anymore
119
// At this point, Robotnik will be at the same point he started at before calling this function
120
Object.YPos += 0x100000
121
end if
122
end if
123
end if
124
125
end function
126
127
128
sub ObjectMain
129
switch Object.State
130
case R7EGGMAN_AWAITPLAYER
131
// Setup some things for the Boss Fight
132
133
// Set screen bounds
134
Stage.XBoundary2 = Object.iXPos
135
Stage.XBoundary2 -= 64
136
137
TempValue0 = Stage.XBoundary2
138
TempValue0 -= Screen.XSize
139
Stage.NewXBoundary1 = TempValue0
140
141
// Player Object collision checking in ObjectMain, that's certainly risky!
142
// (This only checks against the last player on the list! Not a big issue with CD's single Player setup, but still worthy of concern...)
143
PlayerObjectCollision(C_TOUCH, -256, -256, 0, 256)
144
145
if CheckResult == true
146
// If the player's within range, start the startup sequence
147
148
CreateTempObject(TypeName[Fade Music], FADEMUSIC_FADE_TO_BOSS, Object.XPos, Object.YPos)
149
150
Object.Direction = FACING_LEFT
151
152
// From this point on, make Robotnik always active, as the Player very well may outrun him during the race
153
Object.Priority = PRIORITY_ACTIVE
154
155
Object.State++
156
end if
157
break
158
159
case R7EGGMAN_WAIT
160
// Before making his grand enterance, hide off screen for a couple of seconds...
161
if Object.Timer < 120
162
Object.Timer++
163
else
164
// He's prepared, turn the thruster on and start moving!
165
Object.Timer = 0
166
Object.Animation = R7EGGMANANI_THRUSTERON
167
Object.State++
168
end if
169
break
170
171
// The following set of two states is for Robotnik flying across the screen, he's got a movement speed of 6 pixels per second and that's about all that's interesting about them
172
173
case R7EGGMAN_FLYIN_RL
174
if Object.Timer < 140
175
Object.XPos -= 0x60000
176
Object.Timer++
177
else
178
Object.Timer = 0
179
Object.Direction = FACING_RIGHT
180
Object.State++
181
end if
182
break
183
184
case R7EGGMAN_FLYIN_LR
185
if Object.Timer < 160
186
Object.XPos += 0x60000
187
Object.Timer++
188
else
189
Object.Timer = 0
190
Object.Direction = FACING_LEFT
191
Object.State++
192
end if
193
break
194
195
case R7EGGMAN_GOTOMETAL
196
if Object.Timer < 47
197
Object.XPos -= 0x60000
198
Object.Timer++
199
else
200
// Arrived at Metal, stop for a moment while powering him on
201
Object.Timer = 0
202
Object.Animation = R7EGGMANANI_THRUSTEROFF
203
Object.State++
204
end if
205
break
206
207
case R7EGGMAN_STARTUPMETAL
208
if Object.Timer < 94
209
Object.Timer++
210
if Object.Timer == 30
211
// Object[+1] is Metal Sonic
212
Object[+1].State = METALSONIC_TURNRIGHT
213
Object[+1].Animation = ANI_TURNING
214
Object[+1].Timer = 0
215
end if
216
217
if Object.Timer == 90
218
// Metal's now ready, but is Sonic?
219
Object.LaserActive = true
220
end if
221
else
222
Object.Timer = 0
223
Object.Animation = R7EGGMANANI_THRUSTERON
224
225
// This laser around, the explosions should be 6 pixels left of Robotnik
226
Object.LaserOffset = -0x60000
227
Object.State++
228
end if
229
break
230
231
// Following are a bunch of small states to manage Robotnik turning his laser on and off a bunch, with a movement speed of 2 pixels per second
232
233
case R7EGGMAN_INTROLASERON1
234
Object.XPos -= 0x20000
235
if Object.Timer < 6
236
Object.Timer++
237
else
238
Object.Timer = 0
239
Object.LaserActive = false
240
Object.State++
241
end if
242
break
243
244
case R7EGGMAN_INTROLASEROFF1
245
Object.XPos -= 0x20000
246
if Object.Timer < 30
247
Object.Timer++
248
else
249
Object.Timer = 0
250
Object.LaserActive = true
251
Object.State++
252
end if
253
break
254
255
case R7EGGMAN_INTROLASERON2
256
Object.XPos -= 0x20000
257
if Object.Timer < 10
258
Object.Timer++
259
else
260
Object.Timer = 0
261
Object.LaserActive = false
262
Object.State++
263
end if
264
break
265
266
case R7EGGMAN_INTROLASEROFF2
267
Object.XPos -= 0x20000
268
if Object.Timer < 30
269
Object.Timer++
270
else
271
Object.Timer = 0
272
Object.LaserActive = true
273
Object.State++
274
end if
275
break
276
277
case R7EGGMAN_INTROLASERON3
278
Object.XPos -= 0x20000
279
if Object.Timer < 10
280
Object.Timer++
281
else
282
Object.Timer = 0
283
Object.LaserActive = false
284
Object.State++
285
end if
286
287
CallFunction(R7Eggman_FollowGround)
288
break
289
290
case R7EGGMAN_INTROLASEROFF3
291
Object.XPos -= 0x20000
292
if Object.Timer < 120
293
Object.Timer++
294
else
295
if HUD.CurrentTimePeriod == TIME_GOOD_FUTURE
296
// In the Bad Future nothing needs to happen, but if in the Good Future then start playing the Bad Future music
297
if Options.Soundtrack == OST_JP
298
SetMusicTrack("JP/R7D.ogg", 0, true)
299
else
300
SetMusicTrack("US/R7D.ogg", 0, 92324)
301
end if
302
end if
303
304
CreateTempObject(TypeName[Fade Music], FADEMUSIC_SSZEGGMAN, Object.XPos, Object.YPos)
305
306
// Open the starting door
307
Object[-2].State = VERTICALDOOR_START_OPENING
308
309
// And open the ending door as well
310
Object[-1].State = VERTICALDOOR_END_OPENED
311
Object[-1].DrawPosY = 0x400000
312
Object[-1].YPos -= 0x400000
313
314
Object.Timer = 0
315
Object.Direction = FACING_RIGHT
316
Object.LaserActive = true
317
Object.LaserOffset = 0x60000
318
Object.XVelocity = 0x20000
319
Object.State++
320
end if
321
322
CallFunction(R7Eggman_FollowGround)
323
break
324
325
case R7EGGMAN_CHASESTART
326
// This state is essentially an easier version of CHASEMAIN, just toned down a bit since the race just started and the player (& screen bounds) need to adjust
327
328
Object.XPos += Object.XVelocity
329
TempValue0 = Object.iXPos
330
TempValue0 -= 16
331
if Stage.XBoundary2 < 16352
332
TempValue1 = Player.XVelocity
333
TempValue1 >>= 16
334
Stage.XBoundary2 += 6
335
Stage.XBoundary2 += TempValue1
336
end if
337
338
if Stage.XBoundary1 < TempValue0
339
Stage.XBoundary1 = TempValue0
340
end if
341
342
if Object.Timer < 360
343
Object.Timer++
344
else
345
Object.Timer = 0
346
Stage.XBoundary2 = Object[-1].iXPos
347
Stage.XBoundary2 += 112
348
Object.State++
349
end if
350
351
CallFunction(R7Eggman_FollowGround)
352
break
353
354
case R7EGGMAN_CHASEMAIN
355
TempValue0 = Object.XVelocity
356
357
// As the race progresses, Robotnik speeds up...
358
Object.Acceleration++
359
Object.Acceleration &= 0x3FFF
360
361
TempValue1 = Object.Acceleration
362
TempValue1 >>= 4
363
Object.XVelocity += TempValue1
364
if Object.XVelocity > 0x50000
365
// Maximum speed of 5 pixels per frame
366
367
Object.XVelocity = 0x50000
368
end if
369
370
TempValue1 = Screen.XOffset
371
TempValue1 <<= 16
372
TempValue1 -= Object.XPos
373
if TempValue1 > 0
374
TempValue1 >>= 7
375
if TempValue1 > 0x40000
376
TempValue1 = 0x40000
377
end if
378
TempValue0 += TempValue1
379
end if
380
381
if TempValue0 > 0x50000
382
TempValue0 = 0x50000
383
end if
384
385
if TempValue0 > 0x30000
386
TempValue0 -= 0x30000
387
Object.XPos += 0x30000
388
CallFunction(R7Eggman_FollowGround)
389
Object.XPos += TempValue0
390
CallFunction(R7Eggman_FollowGround)
391
else
392
Object.XPos += TempValue0
393
CallFunction(R7Eggman_FollowGround)
394
end if
395
396
// Move the left side of the screen along with Robotnik
397
TempValue0 = Object.iXPos
398
TempValue0 -= 16
399
if Stage.XBoundary1 < TempValue0
400
Stage.XBoundary1 = TempValue0
401
402
// More hardcoded stage bounds...
403
if Stage.XBoundary1 > 15840
404
Stage.XBoundary1 = 15840
405
end if
406
end if
407
408
// Is Robotnik further than 34 pixels before the last door?
409
// (Strange way to put it, I hope you don't mind...)
410
TempValue0 = Object[-1].XPos
411
TempValue0 -= 0x220000
412
if Object.XPos > TempValue0
413
Object.XPos = TempValue0
414
Object.Animation = R7EGGMANANI_THRUSTEROFF
415
Object.XVelocity = 0
416
Object.State++
417
end if
418
break
419
420
// The following 6 states are for when Robotnik turns the laser on and off a bunch of times after the race
421
// Is his button broken or something? I never understood why he'd need to do it so many times like that...
422
423
case R7EGGMAN_ENDLASERON1
424
if Player.Animation != ANI_DYING
425
if Object.Timer < 50
426
Object.Timer++
427
else
428
Object.Timer = 0
429
Object.LaserActive = false
430
Object.State++
431
end if
432
end if
433
break
434
435
case R7EGGMAN_ENDLASEROFF1
436
if Object.Timer < 20
437
Object.Timer++
438
else
439
Object.Timer = 0
440
Object.LaserActive = true
441
Object.State++
442
end if
443
break
444
445
case R7EGGMAN_ENDLASERON2
446
if Object.Timer < 20
447
Object.Timer++
448
else
449
Object.Timer = 0
450
Object.LaserActive = false
451
Object.State++
452
end if
453
break
454
455
case R7EGGMAN_ENDLASEROFF2
456
if Object.Timer < 20
457
Object.Timer++
458
else
459
Object.Timer = 0
460
Object.LaserActive = true
461
Object.State++
462
end if
463
break
464
465
case R7EGGMAN_ENDLASERON3
466
if Object.Timer < 20
467
Object.Timer++
468
else
469
Object.Timer = 0
470
Object.LaserActive = false
471
Object.State++
472
end if
473
break
474
475
case R7EGGMAN_ENDLASEROFF3
476
if Object.Timer < 60
477
Object.Timer++
478
else
479
Object.Timer = 0
480
Object.State++
481
end if
482
break
483
484
case R7EGGMAN_DESCEND
485
// Going down for a moment before retreating...
486
Object.YPos += 0x20000
487
488
if Object.Timer < 42
489
Object.Timer++
490
else
491
Object.Timer = 0
492
Object.LaserActive = false
493
Object.State++
494
end if
495
break
496
497
case R7EGGMAN_PAUSE
498
// Hold for a second...
499
if Object.Timer < 60
500
Object.Timer++
501
else
502
Player.Score += 1000
503
Object.Timer = 0
504
Object.Animation = R7EGGMANANI_THRUSTERON
505
Object.State++
506
end if
507
break
508
509
case R7EGGMAN_FLYAWAY
510
Object.XPos += 0x60000
511
if Object.OutOfBounds == true
512
Object.Type = TypeName[Blank Object]
513
Object.Priority = PRIORITY_BOUNDS
514
515
if HUD.CurrentTimePeriod == TIME_GOOD_FUTURE
516
// In the Bad Future nothing needs to change, but in the Good Future start playing the normal Good Future music again
517
if Options.Soundtrack == OST_JP
518
SetMusicTrack("JP/R7C.ogg", 0, 103060)
519
else
520
SetMusicTrack("US/R7C.ogg", 0, 136670)
521
end if
522
523
CreateTempObject(TypeName[Fade Music], FADEMUSIC_FADE_TO_LEVEL, Object.XPos, Object.YPos)
524
end if
525
526
Stage.NewXBoundary2 = 16352
527
end if
528
break
529
530
end switch
531
532
if Object.LaserActive == true
533
if Object.DebrisTimer == 0
534
CreateTempObject(TypeName[Explosion], 0, Object.XPos, Object.YPos)
535
536
// Offset the new object accordingly as needed
537
// Horizontal offset is +/- 6 pixels depending on Robotnik's current direction, and the laser touches the ground 176 pixels down
538
Object[TempObjectPos].XPos += Object.LaserOffset
539
Object[TempObjectPos].YPos += 0xB00000
540
541
ArrayPos0 = Object.LastExplosion
542
Object.LastExplosion = Object[TempObjectPos].EntityNo
543
Object.DebrisTimer = 8
544
if Object[ArrayPos0].DrawOrder == 3
545
Object[TempObjectPos].DrawOrder = 4
546
547
// Create some Debris with a randomised sprite
548
549
Rand(TempValue0, 4)
550
CreateTempObject(TypeName[Debris], TempValue0, Object.XPos, Object.YPos)
551
552
Object[TempObjectPos].XPos += Object.LaserOffset
553
Object[TempObjectPos].YPos += 0xB00000
554
555
Rand(Object[TempObjectPos].XVelocity, 6)
556
Object[TempObjectPos].XVelocity <<= 16
557
Object[TempObjectPos].XVelocity -= 0x28000
558
Object[TempObjectPos].XVelocity += Object.XVelocity
559
560
Rand(Object[TempObjectPos].YVelocity, 3)
561
Object[TempObjectPos].YVelocity += 2
562
Object[TempObjectPos].YVelocity <<= 16
563
FlipSign(Object[TempObjectPos].YVelocity)
564
end if
565
else
566
// Move the last explosion along with the laser for a little bit
567
568
ArrayPos0 = Object.LastExplosion
569
Object[ArrayPos0].XPos = Object.XPos
570
Object[ArrayPos0].XPos += Object.LaserOffset
571
572
Object[ArrayPos0].YPos = Object.YPos
573
Object[ArrayPos0].YPos += 0xB00000
574
575
Object.DebrisTimer--
576
end if
577
else
578
if Object.DebrisTimer > 0
579
// Move the last explosion along with the laser for a little bit
580
581
ArrayPos0 = Object.LastExplosion
582
Object[ArrayPos0].XPos = Object.XPos
583
Object[ArrayPos0].XPos += Object.LaserOffset
584
585
Object[ArrayPos0].YPos = Object.YPos
586
Object[ArrayPos0].YPos += 0xB00000
587
588
Object.DebrisTimer--
589
end if
590
end if
591
592
end sub
593
594
595
sub ObjectPlayerInteraction
596
if Object.LaserActive == true
597
if Object.State < R7EGGMAN_CHASESTART
598
// Use the intro version of the laser hitbox
599
600
PlayerObjectCollision(C_TOUCH, -12, 48, 12, 176)
601
602
if CheckResult == true
603
CallFunction(Player_Hit)
604
end if
605
else
606
if Player.XPos < Object.XPos
607
Player.XPos = Object.XPos
608
609
// Player.RCollisionFlag is a global flag set by Solid Blocks upon having the Player collide to the block's left (the player's right)
610
if Player.RCollisionFlag == true
611
CallFunction(Player_Kill)
612
end if
613
end if
614
615
// Reset the flag, regardless if it was previously true or not
616
Player.RCollisionFlag = false
617
618
if Object.State < R7EGGMAN_ENDLASERON1
619
PlayerObjectCollision(C_TOUCH, -12, 48, 12, 176)
620
else
621
PlayerObjectCollision(C_TOUCH, -64, -256, 16, 176)
622
end if
623
624
if CheckResult == true
625
CallFunction(Player_Kill)
626
end if
627
end if
628
end if
629
630
// Limit Tails's flight when needed
631
632
if Player.YPos < Object.YPos // Is the Player Object higher up than the Robotnik object?
633
if Player.XPos < 0xE000000 // And has the Player Object not yet passed X Position 3584?
634
if Player.State == Player_State_Fly
635
if Player.Timer < 470
636
Player.Timer = 470
637
end if
638
end if
639
end if
640
641
if Player.XPos > 0x38900000 // Alternatively, has the Player Object passed X Position 14480?
642
if Player.State == Player_State_Fly
643
if Player.Timer < 470
644
Player.Timer = 470
645
end if
646
end if
647
end if
648
end if
649
650
end sub
651
652
653
sub ObjectDraw
654
switch Object.Animation
655
case R7EGGMANANI_THRUSTEROFF
656
DrawSpriteFX(0, FX_FLIP, Object.XPos, Object.YPos)
657
658
TempValue0 = Object.AnimationTimer
659
TempValue0 /= 6
660
if TempValue0 == 1
661
// Draw the flashing sprites
662
DrawSpriteFX(1, FX_FLIP, Object.XPos, Object.YPos)
663
DrawSpriteFX(2, FX_FLIP, Object.XPos, Object.YPos)
664
DrawSpriteFX(3, FX_FLIP, Object.XPos, Object.YPos)
665
end if
666
667
if Object.LaserActive == true
668
// Draw the laser, as a series of smaller, chained together sprites
669
TempValue0 = Object.AnimationTimer
670
TempValue0 &= 3
671
TempValue0 >>= 1
672
TempValue0 += 12
673
674
TempValue1 = Object.XPos
675
676
// Start 48 pixels below Robotnik
677
TempValue2 = Object.YPos
678
TempValue2 += 0x300000
679
DrawSpriteXY(TempValue0, TempValue1, TempValue2)
680
681
// For the rest of the pieces, space them away 32 pixels vertically and 2 pixels horizontally, with the horizontal offset depending on Robotnik's direction
682
if Object.Direction == FACING_RIGHT
683
TempValue2 += 0x200000
684
TempValue1 += 0x20000
685
DrawSpriteXY(TempValue0, TempValue1, TempValue2)
686
687
TempValue2 += 0x200000
688
TempValue1 += 0x20000
689
DrawSpriteXY(TempValue0, TempValue1, TempValue2)
690
691
TempValue2 += 0x200000
692
TempValue1 += 0x20000
693
DrawSpriteXY(TempValue0, TempValue1, TempValue2)
694
else
695
TempValue2 += 0x200000
696
TempValue1 -= 0x20000
697
DrawSpriteXY(TempValue0, TempValue1, TempValue2)
698
699
TempValue2 += 0x200000
700
TempValue1 -= 0x20000
701
DrawSpriteXY(TempValue0, TempValue1, TempValue2)
702
703
TempValue2 += 0x200000
704
TempValue1 -= 0x20000
705
DrawSpriteXY(TempValue0, TempValue1, TempValue2)
706
end if
707
end if
708
Object.AnimationTimer++
709
Object.AnimationTimer %= 12
710
break
711
712
case R7EGGMANANI_THRUSTERON
713
TempValue0 = Object.AnimationTimer
714
TempValue0 &= 1
715
if TempValue0 == 1
716
Object.Frame++
717
Object.Frame &= 3
718
end if
719
TempValue0 = Object.Frame
720
TempValue0 += 4
721
DrawSpriteFX(TempValue0, FX_FLIP, Object.XPos, Object.YPos)
722
TempValue0 += 4
723
DrawSpriteFX(TempValue0, FX_FLIP, Object.XPos, Object.YPos)
724
TempValue0 = Object.AnimationTimer
725
TempValue0 /= 6
726
727
DrawSpriteFX(0, FX_FLIP, Object.XPos, Object.YPos)
728
729
if TempValue0 == 1
730
// Draw the flashing sprites
731
DrawSpriteFX(1, FX_FLIP, Object.XPos, Object.YPos)
732
DrawSpriteFX(2, FX_FLIP, Object.XPos, Object.YPos)
733
DrawSpriteFX(3, FX_FLIP, Object.XPos, Object.YPos)
734
end if
735
736
if Object.LaserActive == true
737
// Draw the Laser
738
TempValue0 = Object.AnimationTimer
739
TempValue0 &= 3
740
TempValue0 >>= 1
741
TempValue0 += 12
742
743
TempValue1 = Object.XPos
744
TempValue2 = Object.YPos
745
TempValue2 += 0x300000
746
747
DrawSpriteXY(TempValue0, TempValue1, TempValue2)
748
if Object.Direction == FACING_RIGHT
749
TempValue2 += 0x200000
750
TempValue1 += 0x20000
751
DrawSpriteXY(TempValue0, TempValue1, TempValue2)
752
753
TempValue2 += 0x200000
754
TempValue1 += 0x20000
755
DrawSpriteXY(TempValue0, TempValue1, TempValue2)
756
757
TempValue2 += 0x200000
758
TempValue1 += 0x20000
759
DrawSpriteXY(TempValue0, TempValue1, TempValue2)
760
else
761
TempValue2 += 0x200000
762
TempValue1 -= 0x20000
763
DrawSpriteXY(TempValue0, TempValue1, TempValue2)
764
765
TempValue2 += 0x200000
766
TempValue1 -= 0x20000
767
DrawSpriteXY(TempValue0, TempValue1, TempValue2)
768
769
TempValue2 += 0x200000
770
TempValue1 -= 0x20000
771
DrawSpriteXY(TempValue0, TempValue1, TempValue2)
772
end if
773
end if
774
775
Object.AnimationTimer++
776
Object.AnimationTimer %= 12
777
break
778
779
end switch
780
781
end sub
782
783
784
sub ObjectStartup
785
LoadSpriteSheet("R7/Objects2.gif")
786
787
// Main Robotnik + Ship Frame
788
SpriteFrame(-40, -24, 72, 72, 91, 1)
789
790
// Motor Animation Frame
791
SpriteFrame(-24, -9, 24, 16, 164, 1)
792
793
// Lit Light Frame
794
SpriteFrame(22, 27, 8, 8, 75, 99)
795
796
// Backside Animation Frame
797
SpriteFrame(-32, 8, 16, 24, 176, 142)
798
799
// Thruster Flames
800
SpriteFrame(-68, -10, 40, 16, 66, 133)
801
SpriteFrame(-60, -10, 32, 16, 66, 116)
802
SpriteFrame(-68, -10, 40, 16, 124, 150)
803
SpriteFrame(-60, -10, 32, 16, 66, 150)
804
SpriteFrame(-63, 30, 32, 16, 66, 150)
805
SpriteFrame(-55, 30, 24, 16, 99, 150)
806
SpriteFrame(-63, 30, 32, 16, 66, 116)
807
SpriteFrame(-55, 30, 24, 16, 99, 116)
808
809
// Laser
810
SpriteFrame(-8, 0, 16, 32, 91, 74)
811
SpriteFrame(-8, 0, 16, 32, 108, 74)
812
813
end sub
814
815
816
// ========================
817
// Editor Subs
818
// ========================
819
820
sub RSDKDraw
821
DrawSprite(0)
822
end sub
823
824
825
sub RSDKLoad
826
LoadSpriteSheet("R7/Objects2.gif")
827
SpriteFrame(-40, -24, 72, 72, 91, 1)
828
829
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
830
end sub
831
832