Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/R5/BossSpark.txt
1319 views
1
//-----------------Sonic CD Boss Spark 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.XVelocity
8
#alias Object.Value2 : Object.YVelocity
9
10
#alias 0 : BOSSSPARK_GRIND
11
#alias 1 : BOSSSPARK_LAND
12
13
14
sub ObjectMain
15
16
// Have a horizontal deceleration value of 0.125 pixels per frame
17
Object.XVelocity -= 0x2000
18
19
// Enforce a maximum left velocity of 3 pixels per frame
20
if Object.XVelocity < -0x30000
21
Object.XVelocity = -0x30000
22
end if
23
24
// Update X movement
25
Object.XPos += Object.XVelocity
26
27
if Object.PropertyValue == BOSSSPARK_LAND
28
29
// Move the Spark down by 0.125 pixels
30
Object.YVelocity += 0x2000
31
32
// Update the Spark's Y Position
33
Object.YPos += Object.YVelocity
34
35
// Unload when no longer needed
36
if Object.OutOfBounds == true
37
Object.Type = TypeName[Blank Object]
38
end if
39
40
else
41
// For a grinding-generated Spark, just show for around half a second and disappear after that
42
43
if Object.Timer < 36
44
Object.Timer++
45
else
46
Object.Type = TypeName[Blank Object]
47
end if
48
49
end if
50
51
end sub
52
53
54
sub ObjectDraw
55
56
TempValue0 = Object.Frame
57
TempValue0 >>= 2
58
59
DrawSprite(TempValue0)
60
61
// Object animation is progressed here
62
Object.Frame++
63
Object.Frame %= 20
64
65
end sub
66
67
68
sub ObjectStartup
69
LoadSpriteSheet("R5/Objects2.gif")
70
71
// Boss Spark Frames
72
// Their offset isn't in the center, these sprites are actually offset to the left a bit
73
SpriteFrame(-2, -4, 16, 8, 131, 155)
74
SpriteFrame(-2, -4, 16, 8, 131, 164)
75
SpriteFrame(-2, -4, 16, 8, 131, 173)
76
SpriteFrame(-2, -4, 16, 8, 131, 182)
77
SpriteFrame(-2, -4, 16, 8, 148, 182)
78
79
end sub
80
81
82
// ========================
83
// Editor Subs
84
// ========================
85
86
sub RSDKDraw
87
DrawSprite(0)
88
end sub
89
90
91
sub RSDKLoad
92
LoadSpriteSheet("R5/Objects2.gif")
93
SpriteFrame(-2, -4, 16, 8, 131, 155)
94
95
// Although used by the object, it shouldn't be set from the editor
96
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
97
end sub
98
99