Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/R4/BossBubble2.txt
1319 views
1
//---------------Sonic CD Boss Bubble 2 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
8
// States
9
#alias 0 : BOSSBUBBLE2_GROWTH_1
10
#alias 1 : BOSSBUBBLE2_GROWTH_2
11
#alias 2 : BOSSBUBBLE2_BREATHABLE
12
#alias 3 : BOSSBUBBLE2_CONSUMED
13
#alias 4 : BOSSBUBBLE2_DISSAPEAR
14
15
// Stage SFX
16
#alias 6 : SFX_S_BREATHING
17
18
19
sub ObjectMain
20
switch Object.State
21
case BOSSBUBBLE2_GROWTH_1
22
if Object.Timer < 20
23
Object.Timer++
24
else
25
Object.State++
26
end if
27
break
28
29
case BOSSBUBBLE2_GROWTH_2
30
Object.State++
31
break
32
33
case BOSSBUBBLE2_BREATHABLE // only here for display purposes, waits for player to interact with it
34
break
35
36
case BOSSBUBBLE2_CONSUMED
37
if Object.Timer < 22
38
Object.Timer++
39
else
40
Object.State++
41
end if
42
break
43
44
case BOSSBUBBLE2_DISSAPEAR
45
if Object.Timer < 42
46
Object.Timer++
47
else
48
Object.Type = TypeName[Blank Object]
49
end if
50
break
51
end switch
52
end sub
53
54
55
sub ObjectPlayerInteraction
56
if Object.State == BOSSBUBBLE2_BREATHABLE
57
CheckResult = false
58
if Player.Animation == ANI_JUMPING
59
CheckResult = true
60
end if
61
#platform: Use_Origins
62
if Stage.PlayerListPos == PLAYER_KNUCKLES
63
if Player.Animation == ANI_GLIDING
64
CheckResult = true
65
end if
66
if Player.Animation == ANI_GLIDING_STOP
67
CheckResult = true
68
end if
69
end if
70
if Stage.PlayerListPos == PLAYER_AMY
71
if Player.Animation == ANI_HAMMER_JUMP
72
CheckResult = true
73
end if
74
end if
75
#endplatform
76
if CheckResult == true
77
PlayerObjectCollision(C_TOUCH, -8, -8, 8, 8)
78
if CheckResult == true
79
Object.State = BOSSBUBBLE2_CONSUMED
80
FlipSign(Player.Speed)
81
FlipSign(Player.XVelocity)
82
83
Player.YVelocity = 0x40000
84
#platform: Use_Origins
85
if Player.Animation == ANI_HAMMER_JUMP
86
Player.State = Player_State_Air_NoDropDash
87
end if
88
#endplatform
89
90
Player.Animation = ANI_BREATHING
91
Player.AirTimer = 0
92
93
PlayStageSfx(SFX_S_BREATHING, false)
94
95
#platform: Use_Haptics
96
HapticEffect(19, 0, 0, 0)
97
#endplatform
98
end if
99
end if
100
101
if Player.Animation == ANI_FLYING
102
PlayerObjectCollision(C_TOUCH, -8, -8, 8, 8)
103
if CheckResult == true
104
Object.State = BOSSBUBBLE2_CONSUMED
105
FlipSign(Player.Speed)
106
FlipSign(Player.XVelocity)
107
108
Player.YVelocity = 0x40000
109
110
Player.Animation = ANI_BREATHING
111
112
#platform: Use_Origins
113
Player.State = Player_State_Air_NoDropDash
114
#endplatform
115
116
#platform: Use_Standalone
117
Player.State = Player_State_Air
118
#endplatform
119
120
Player.AirTimer = 0
121
PlayStageSfx(SFX_S_BREATHING, false)
122
123
#platform: Use_Haptics
124
HapticEffect(19, 0, 0, 0)
125
#endplatform
126
end if
127
end if
128
end if
129
end sub
130
131
132
sub ObjectDraw
133
DrawSprite(Object.State)
134
end sub
135
136
137
sub ObjectStartup
138
LoadSpriteSheet("R4/Objects2.gif")
139
140
SpriteFrame(-8, -8, 16, 16, 99, 118) // #0 - Small bubble
141
SpriteFrame(-12, -12, 24, 24, 116, 126) // #1 - Medium bubble
142
SpriteFrame(-16, -16, 32, 32, 222, 115) // #2 - Big bubble
143
SpriteFrame(-16, -16, 32, 32, 189, 115) // #3 - Big bubble inhaled
144
SpriteFrame(-16, -16, 32, 32, 156, 126) // #4 - Big bubler bursted
145
end sub
146
147
148
// ========================
149
// Editor Subs
150
// ========================
151
152
sub RSDKDraw
153
DrawSprite(0)
154
end sub
155
156
157
sub RSDKLoad
158
LoadSpriteSheet("R4/Objects2.gif")
159
SpriteFrame(-16, -16, 32, 32, 222, 115) // #2 - Big bubble
160
161
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
162
end sub
163
164