Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/Global/Spikes.txt
1319 views
1
//-----------------Sonic CD Spikes Script---------------------//
2
//--------Scripted by Christian Whitehead 'The Taxman'--------//
3
//-------Unpacked By Rubberduckycooly's Script Unpacker-------//
4
5
// Aliases
6
#alias Player.Value4 : Player.InvincibleTimer
7
8
// Property Values
9
#alias 0 : SPIKE_DIRECTION_UP
10
#alias 1 : SPIKE_DIRECTION_RIGHT
11
#alias 2 : SPIKE_DIRECTION_LEFT
12
#alias 3 : SPIKE_DIRECTION_DOWN
13
14
15
sub ObjectPlayerInteraction
16
switch Object.PropertyValue
17
case SPIKE_DIRECTION_UP
18
PlayerObjectCollision(C_BOX, -16, -12, 16, 16)
19
#platform: Use_Origins
20
if Player.Animation == ANI_LEDGEPULLUP
21
PlayerObjectCollision(C_BOX, -14, -12, 14, 16)
22
end if
23
#endplatform
24
if Player.YVelocity > -1
25
if Player.InvincibleTimer == 0
26
PlayerObjectCollision(C_TOUCH, -15, -13, 15, -12)
27
if CheckResult == true
28
Player.State = Player_State_GotHit
29
if Player.XPos > Object.XPos
30
Player.Speed = 0x20000
31
else
32
Player.Speed = -0x20000
33
end if
34
end if
35
end if
36
end if
37
break
38
39
case SPIKE_DIRECTION_RIGHT
40
PlayerObjectCollision(C_BOX, -16, -16, 15, 16)
41
if Player.XVelocity <= 0
42
if Player.InvincibleTimer == 0
43
PlayerObjectCollision(C_TOUCH, 12, -15, 16, 15)
44
if CheckResult == true
45
Player.State = Player_State_GotHit
46
Player.Speed = 0x20000
47
end if
48
end if
49
end if
50
break
51
52
case SPIKE_DIRECTION_LEFT
53
PlayerObjectCollision(C_BOX, -15, -16, 16, 16)
54
if Player.InvincibleTimer == 0
55
PlayerObjectCollision(C_TOUCH, -16, -15, -12, 15)
56
if CheckResult == true
57
Player.State = Player_State_GotHit
58
Player.Speed = -0x20000
59
end if
60
end if
61
break
62
63
case SPIKE_DIRECTION_DOWN
64
TempValue0 = Player.YVelocity
65
PlayerObjectCollision(C_BOX, -16, -16, 16, 15)
66
if TempValue0 < 1
67
if Player.InvincibleTimer == 0
68
PlayerObjectCollision(C_TOUCH, -15, 12, 15, 16)
69
if CheckResult == true
70
Player.State = Player_State_GotHit
71
if Player.XPos > Object.XPos
72
Player.Speed = 0x20000
73
else
74
Player.Speed = -0x20000
75
end if
76
end if
77
end if
78
end if
79
break
80
81
end switch
82
end sub
83
84
85
sub ObjectDraw
86
DrawSprite(Object.PropertyValue)
87
end sub
88
89
90
sub ObjectStartup
91
LoadSpriteSheet("Global/Items3.gif")
92
93
SpriteFrame(-16, -16, 32, 32, 50, 1) // #0 - Spikes facing up
94
SpriteFrame(-16, -16, 32, 32, 50, 34) // #1 - Spikes facing right
95
SpriteFrame(-16, -16, 32, 32, 50, 67) // #2 - Spikes facing left
96
SpriteFrame(-16, -16, 32, 32, 50, 100) // #3 - Spikes facing down
97
end sub
98
99
100
// ========================
101
// Editor Subs
102
// ========================
103
104
sub RSDKEdit
105
if Editor.ReturnVariable == true
106
switch Editor.VariableID
107
case EDIT_VAR_PROPVAL // Property Value
108
CheckResult = Object.PropertyValue
109
break
110
case 0 // Orientation
111
CheckResult = Object.PropertyValue
112
break
113
end switch
114
else
115
switch Editor.VariableID
116
case EDIT_VAR_PROPVAL // Property Value
117
Object.PropertyValue = Editor.VariableValue
118
break
119
case 0 // Orientation
120
Object.PropertyValue = Editor.VariableValue
121
break
122
end switch
123
end if
124
end sub
125
126
127
sub RSDKDraw
128
DrawSprite(Object.PropertyValue)
129
end sub
130
131
132
sub RSDKLoad
133
LoadSpriteSheet("Global/Items3.gif")
134
SpriteFrame(-16, -16, 32, 32, 50, 1) // #0 - Spikes facing up
135
SpriteFrame(-16, -16, 32, 32, 50, 34) // #1 - Spikes facing right
136
SpriteFrame(-16, -16, 32, 32, 50, 67) // #2 - Spikes facing left
137
SpriteFrame(-16, -16, 32, 32, 50, 100) // #3 - Spikes facing down
138
139
AddEditorVariable("Orientation")
140
SetActiveVariable("Orientation")
141
AddEnumVariable("Up", 0)
142
AddEnumVariable("Right", 1)
143
AddEnumVariable("Left", 2)
144
AddEnumVariable("Down", 3)
145
end sub
146
147