Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/R1/BouncePole.txt
1319 views
1
//-----------------Sonic CD Bounce Pole 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
8
// Gravity
9
#alias 1 : GRAVITY_AIR
10
11
// Not directly used, but added for documentation purposes
12
#alias 0 : DIRECTION_RIGHT
13
#alias 1 : DIRECTION_LEFT
14
15
16
sub ObjectPlayerInteraction
17
// Check:
18
// Collision with object
19
// Player is in the air
20
// The vertical momentum goes downwards
21
PlayerObjectCollision(C_TOUCH, -16, -8, 16, 8)
22
if CheckResult == true
23
if Player.Gravity == GRAVITY_AIR
24
if Player.YVelocity > 0
25
26
#platform: Use_Origins
27
Player.State = Player_State_Air_NoDropDash
28
#endplatform
29
30
#platform: Use_Standalone
31
Player.State = Player_State_Air
32
#endplatform
33
Player.Timer = 0
34
Player.Animation = ANI_JUMPING
35
FlipSign(Player.YVelocity)
36
Player.YVelocity -= 0x20000
37
38
// Vertical velocity cap
39
if Player.YVelocity < -0xA0000
40
Player.YVelocity = -0xA0000
41
end if
42
43
Object.Frame = 1 // Start bounce pole animation
44
end if
45
end if
46
end if
47
end sub
48
49
50
sub ObjectDraw
51
Object.Direction = Object.PropertyValue
52
DrawSpriteFX(Object.Frame, FX_FLIP, Object.XPos, Object.YPos)
53
if Object.Frame > 0
54
55
Object.FrameTimer++
56
if Object.FrameTimer == 3
57
Object.FrameTimer = 0
58
59
Object.Frame++
60
if Object.Frame > 20
61
Object.Frame = 0
62
end if
63
end if
64
end if
65
end sub
66
67
68
sub ObjectStartup
69
LoadSpriteSheet("R1/Objects.gif")
70
71
SpriteFrame(-16, -8, 32, 16, 190, 34) // #0 - Bounce Pole Still
72
73
SpriteFrame(-16, -8, 32, 16, 190, 34) // #1 - Bounce Pole Bounce Frame 0
74
SpriteFrame(-16, -8, 32, 20, 190, 80) // #2 - Bounce Pole Bounce Frame 1
75
SpriteFrame(-16, -8, 32, 16, 190, 34) // #3 - Bounce Pole Bounce Frame 2
76
SpriteFrame(-16, -20, 32, 28, 190, 51) // #4 - Bounce Pole Bounce Frame 3
77
SpriteFrame(-16, -8, 32, 16, 190, 34) // #5 - Bounce Pole Bounce Frame 4
78
SpriteFrame(-16, -8, 32, 20, 190, 80) // #6 - Bounce Pole Bounce Frame 5
79
SpriteFrame(-16, -8, 32, 16, 190, 34) // #7 - Bounce Pole Bounce Frame 6
80
SpriteFrame(-16, -8, 32, 16, 190, 34) // #8 - Bounce Pole Bounce Frame 7
81
SpriteFrame(-16, -8, 32, 20, 190, 80) // #9 - Bounce Pole Bounce Frame 8
82
SpriteFrame(-16, -8, 32, 16, 190, 34) // #10 - Bounce Pole Bounce Frame 9
83
SpriteFrame(-16, -20, 32, 28, 190, 51) // #11 - Bounce Pole Bounce Frame 10
84
SpriteFrame(-16, -8, 32, 16, 190, 34) // #12 - Bounce Pole Bounce Frame 11
85
SpriteFrame(-16, -8, 32, 20, 190, 80) // #13 - Bounce Pole Bounce Frame 12
86
SpriteFrame(-16, -8, 32, 16, 190, 34) // #14 - Bounce Pole Bounce Frame 13
87
SpriteFrame(-16, -8, 32, 16, 190, 34) // #15 - Bounce Pole Bounce Frame 14
88
SpriteFrame(-16, -8, 32, 20, 190, 80) // #16 - Bounce Pole Bounce Frame 15
89
SpriteFrame(-16, -8, 32, 16, 190, 34) // #17 - Bounce Pole Bounce Frame 16
90
SpriteFrame(-16, -20, 32, 28, 190, 51) // #18 - Bounce Pole Bounce Frame 17
91
SpriteFrame(-16, -8, 32, 16, 190, 34) // #19 - Bounce Pole Bounce Frame 18
92
SpriteFrame(-16, -8, 32, 20, 190, 80) // #20 - Bounce Pole Bounce Frame 19
93
end sub
94
95
96
// ========================
97
// Editor Subs
98
// ========================
99
100
sub RSDKEdit
101
if Editor.ReturnVariable == true
102
switch Editor.VariableID
103
case EDIT_VAR_PROPVAL // Property Value
104
CheckResult = Object.PropertyValue
105
CheckResult &= 1
106
break
107
case 0 // direction
108
CheckResult = Object.PropertyValue
109
CheckResult &= 1
110
break
111
end switch
112
else
113
switch Editor.VariableID
114
case EDIT_VAR_PROPVAL // Property Value
115
Object.PropertyValue = Editor.VariableValue
116
Object.PropertyValue &= 1
117
break
118
case 0 // direction
119
Object.PropertyValue = Editor.VariableValue
120
Object.PropertyValue &= 1
121
break
122
end switch
123
end if
124
end sub
125
126
127
sub RSDKDraw
128
Object.Direction = Object.PropertyValue
129
DrawSpriteFX(0, FX_FLIP, Object.XPos, Object.YPos)
130
end sub
131
132
133
sub RSDKLoad
134
LoadSpriteSheet("R1/Objects.gif")
135
136
SpriteFrame(-16, -8, 32, 16, 190, 34) // #0 - Bounce Pole Still
137
138
139
AddEditorVariable("direction")
140
SetActiveVariable("direction")
141
AddEnumVariable("Right", 0)
142
AddEnumVariable("Left", 1)
143
end sub
144
145