Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/R8/R8Spikes.txt
1319 views
1
//----------------Sonic CD R8 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 : DRAWING_PLANE_A
10
#alias 1 : DRAWING_PLANE_B
11
12
13
sub ObjectPlayerInteraction
14
if Player.CollisionPlane == Object.PropertyValue
15
PlayerObjectCollision(C_BOX, -16, -12, 16, 16)
16
if Player.YVelocity > -1
17
if Player.InvincibleTimer == 0
18
PlayerObjectCollision(C_TOUCH, -15, -13, 15, -12)
19
if CheckResult == true
20
Player.State = Player_State_GotHit
21
if Player.XPos > Object.XPos
22
Player.Speed = 0x20000
23
else
24
Player.Speed = -0x20000
25
end if
26
end if
27
end if
28
end if
29
end if
30
end sub
31
32
33
sub ObjectDraw
34
DrawSprite(0)
35
end sub
36
37
38
sub ObjectStartup
39
LoadSpriteSheet("Global/Items3.gif")
40
41
SpriteFrame(-16, -16, 32, 32, 50, 1) // #0 - Spikes
42
43
ArrayPos0 = 32
44
while ArrayPos0 < 1056
45
if Object[ArrayPos0].Type == TypeName[R8 Spikes]
46
if Object[ArrayPos0].PropertyValue == DRAWING_PLANE_B
47
Object[ArrayPos0].DrawOrder = 1
48
end if
49
end if
50
ArrayPos0++
51
loop
52
end sub
53
54
55
// ========================
56
// Editor Subs
57
// ========================
58
59
sub RSDKEdit
60
if Editor.ReturnVariable == true
61
switch Editor.VariableID
62
case EDIT_VAR_PROPVAL // Property Value
63
CheckResult = Object.PropertyValue
64
CheckResult &= 1
65
break
66
case 0 // drawPlane
67
CheckResult = Object.PropertyValue
68
CheckResult &= 1
69
break
70
end switch
71
else
72
switch Editor.VariableID
73
case EDIT_VAR_PROPVAL // Property Value
74
Object.PropertyValue = Editor.VariableValue
75
Object.PropertyValue &= 1
76
break
77
case 0 // drawPlane
78
Object.PropertyValue = Editor.VariableValue
79
Object.PropertyValue &= 1
80
break
81
end switch
82
end if
83
end sub
84
85
sub RSDKDraw
86
Object.InkEffect = Object.PropertyValue
87
DrawSpriteFX(0, FX_INK, Object.XPos, Object.YPos)
88
end sub
89
90
91
sub RSDKLoad
92
LoadSpriteSheet("Global/Items3.gif")
93
94
SpriteFrame(-16, -16, 32, 32, 50, 1) // #0 - Spikes
95
96
AddEditorVariable("drawPlane")
97
SetActiveVariable("drawPlane")
98
AddEnumVariable("Plane A", DRAWING_PLANE_A)
99
AddEnumVariable("Plane B", DRAWING_PLANE_B)
100
end sub
101
102