Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/R3/PinballBomb.txt
1319 views
1
//---------------Sonic CD Pinball Bomb Script-----------------//
2
//--------Scripted by Christian Whitehead 'The Taxman'--------//
3
//-------Unpacked By Rubberduckycooly's Script Unpacker-------//
4
5
// Aliases
6
#alias Object.Value0 : Object.FrameTimer
7
#alias Object.Value1 : Object.XVelocity
8
#alias Object.Value2 : Object.YVelocity
9
#alias Object.Value3 : Object.Bounces
10
11
// Collision Sides
12
#alias 0 : CSIDE_FLOOR
13
#alias 1 : CSIDE_LWALL
14
#alias 2 : CSIDE_RWALL
15
16
// Gravity
17
#alias 1 : GRAVITY_AIR
18
19
// Global SFX
20
#alias 22 : SFX_G_EXPLOSION
21
22
// Priority
23
#alias 1 : PRIORITY_ACTIVE
24
25
26
sub ObjectMain
27
Object.YVelocity += 0x2000
28
// if the bomb goes fast enough, get to the background
29
if Object.YVelocity > 0x40000
30
Object.DrawOrder = 3
31
end if
32
Object.XPos += Object.XVelocity
33
Object.YPos += Object.YVelocity
34
35
Object.FrameTimer++
36
Object.FrameTimer &= 3
37
38
if Object.XVelocity > 0
39
ObjectTileCollision(CSIDE_LWALL, 8, 0, 0)
40
else
41
ObjectTileCollision(CSIDE_RWALL, -8, 0, 0)
42
end if
43
if CheckResult == true
44
FlipSign(Object.XVelocity)
45
end if
46
47
ObjectTileCollision(CSIDE_FLOOR, 0, 8, 0)
48
if CheckResult == true
49
FlipSign(Object.YVelocity)
50
Object.YVelocity >>= 1
51
52
if Object.Bounces < 1
53
Object.Bounces++
54
else
55
PlaySfx(SFX_G_EXPLOSION, false)
56
ResetObjectEntity(Object.EntityNo, TypeName[Explosion], 0, Object.XPos, Object.YPos)
57
end if
58
end if
59
end sub
60
61
62
sub ObjectPlayerInteraction
63
PlayerObjectCollision(C_TOUCH, -8, -8, 8, 8)
64
if CheckResult == true
65
PlaySfx(SFX_G_EXPLOSION, false)
66
67
#platform: Use_Haptics
68
HapticEffect(96, 0, 0, 0)
69
#endplatform
70
71
ResetObjectEntity(Object.EntityNo, TypeName[Explosion], 0, Object.XPos, Object.YPos)
72
Object.Priority = PRIORITY_ACTIVE
73
74
TempValue0 = Player.XPos
75
TempValue0 -= Object.XPos
76
77
TempValue1 = Player.YPos
78
TempValue1 -= Object.YPos
79
ATan2(TempValue2, TempValue0, TempValue1)
80
81
Cos256(TempValue0, TempValue2)
82
Sin256(TempValue1, TempValue2)
83
TempValue0 *= 0x700
84
TempValue1 *= 0x700
85
86
Player.XVelocity = TempValue0
87
Player.YVelocity = TempValue1
88
Player.Speed = Player.XVelocity
89
90
Player.Gravity = GRAVITY_AIR
91
Player.Timer = 0
92
end if
93
end sub
94
95
96
sub ObjectDraw
97
if Object.FrameTimer == 0
98
DrawSprite(0)
99
else
100
DrawSprite(1)
101
end if
102
end sub
103
104
105
sub ObjectStartup
106
LoadSpriteSheet("R3/Objects2.gif")
107
108
SpriteFrame(-12, -12, 24, 24, 232, 0) // #0 - Pinball Bomb Frame 0
109
SpriteFrame(-8, -8, 16, 16, 130, 67) // #1 - Pinball Bomb Frame 1
110
end sub
111
112
113
// ========================
114
// Editor Subs
115
// ========================
116
117
sub RSDKDraw
118
DrawSprite(0)
119
end sub
120
121
122
sub RSDKLoad
123
LoadSpriteSheet("R3/Objects2.gif")
124
125
SpriteFrame(-12, -12, 24, 24, 232, 0) // #0 - Pinball Bomb
126
127
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
128
end sub
129
130