Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/R5/KWeb.txt
1319 views
1
//---------------Sonic CD Kumo Kumo Web Script----------------//
2
//--------Scripted by Christian Whitehead 'The Taxman'--------//
3
//-------Unpacked By Rubberduckycooly's Script Unpacker-------//
4
5
// Aliases
6
#alias 0 : KUMOKUMOWEB_THROWN
7
#alias 1 : KUMOKUMOWEB_ATTACHED
8
9
#alias Object.Value0 : Object.Timer
10
#alias Object.Value1 : Object.XVelocity
11
12
13
sub ObjectMain
14
15
if Object.State == KUMOKUMOWEB_THROWN
16
17
// Fly through the air
18
Object.XPos += Object.XVelocity
19
20
if Object.OutOfBounds == true
21
// Unload if out of bounds
22
Object.Type = TypeName[Blank Object]
23
else
24
25
// If far vertically too, then unload too
26
TempValue0 = Screen.YOffset
27
TempValue0 -= 8
28
TempValue0 <<= 16
29
if Object.YPos < TempValue0
30
Object.Type = TypeName[Blank Object]
31
end if
32
33
end if
34
else
35
36
// Attached to a Player
37
38
if Object.Timer < 120
39
Object.Timer++
40
41
// Slow the Player down to a maximum speed of 0.25 pixels a second
42
43
// Right-wards limit
44
if Player.Speed > 0x4000
45
Player.Speed = 0x4000
46
end if
47
48
// Left-wards limit
49
if Player.Speed < -0x4000
50
Player.Speed = -0x4000
51
end if
52
53
else
54
55
// The Web's sticky time is over, unload now
56
Object.Type = TypeName[Blank Object]
57
58
end if
59
end if
60
61
end sub
62
63
64
sub ObjectPlayerInteraction
65
66
// Check to see if the Web should attach to Sonic
67
// (Although it doesn't matter too much anyway, this check continues to run even if the Web is already in its ATTACHED state)
68
PlayerObjectCollision(C_TOUCH, -6, -6, 6, 6)
69
if CheckResult == true
70
Object.State = KUMOKUMOWEB_ATTACHED
71
end if
72
73
end sub
74
75
76
sub ObjectDraw
77
78
if Object.State == KUMOKUMOWEB_ATTACHED
79
// Attached Webs should stick to the Player
80
81
Object.XPos = Player.XPos
82
Object.YPos = Player.YPos
83
end if
84
85
TempValue0 = Object.Frame
86
TempValue0 /= 3
87
88
DrawSprite(TempValue0)
89
90
Object.Frame++
91
Object.Frame %= 6
92
93
end sub
94
95
96
sub ObjectStartup
97
LoadSpriteSheet("R5/Objects.gif")
98
99
// Kumo Kumo Web Frames
100
SpriteFrame(-12, -8, 24, 16, 69, 1)
101
SpriteFrame(-12, -8, 24, 16, 94, 1)
102
103
end sub
104
105
106
// ========================
107
// Editor Subs
108
// ========================
109
110
sub RSDKDraw
111
DrawSprite(0)
112
end sub
113
114
115
sub RSDKLoad
116
LoadSpriteSheet("R5/Objects.gif")
117
SpriteFrame(-12, -8, 24, 16, 69, 1)
118
119
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
120
end sub
121
122