Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/Global/Invincibility.txt
1319 views
1
//----------------Sonic CD Invincibility Script---------------//
2
//--------Scripted by Christian Whitehead 'The Taxman'--------//
3
//-------Unpacked By Rubberduckycooly's Script Unpacker-------//
4
5
// Aliases
6
#alias Object.Value0 : Object.Timer
7
8
// States
9
#alias 0 : INVINCIBILITY_STATE
10
#alias 1 : INVINCIBILITY_AFTERIMAGE
11
12
// Ink
13
#alias 2 : INK_ALPHA
14
15
16
sub ObjectDraw
17
switch Object.State
18
case INVINCIBILITY_STATE
19
Object.Timer++
20
if Object.Timer > 3
21
Object.Timer = 0
22
23
CreateTempObject(TypeName[Invincibility], 0, Player.XPos, Player.YPos)
24
Object[TempObjectPos].State = INVINCIBILITY_AFTERIMAGE
25
Object[TempObjectPos].InkEffect = INK_ALPHA
26
Object[TempObjectPos].Alpha = 256
27
Object[TempObjectPos].DrawOrder = 4
28
29
Object.Frame = Ring.Frame
30
Object.Frame &= 3
31
32
if Warp.Timer == 0
33
DrawSpriteXY(Object.Frame, Player.XPos, Player.YPos)
34
end if
35
end if
36
break
37
38
case INVINCIBILITY_AFTERIMAGE
39
Object.Frame = Ring.Frame
40
Object.Frame &= 3
41
42
if Warp.Timer == 0
43
DrawSpriteFX(Object.Frame, FX_INK, Object.XPos, Object.YPos)
44
end if
45
46
Object.Alpha -= 8
47
if Object.Alpha == 128
48
Object.Type = TypeName[Blank Object]
49
end if
50
break
51
52
end switch
53
end sub
54
55
56
sub ObjectStartup
57
LoadSpriteSheet("Global/Items3.gif")
58
59
SpriteFrame(-24, -24, 48, 48, 1, 1) // #0 - Invincibility Frame 0
60
SpriteFrame(-24, -24, 48, 48, 1, 50) // #1 - Invincibility Frame 1
61
SpriteFrame(-24, -24, 48, 48, 1, 99) // #2 - Invincibility Frame 2
62
SpriteFrame(-24, -24, 48, 48, 1, 148) // #3 - Invincibility Frame 3
63
end sub
64
65
66
// ========================
67
// Editor Subs
68
// ========================
69
70
sub RSDKDraw
71
DrawSprite(0)
72
end sub
73
74
75
sub RSDKLoad
76
LoadSpriteSheet("Global/Items3.gif")
77
SpriteFrame(-24, -24, 48, 48, 1, 1) // #0 - Invincibility Frame 0
78
79
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
80
end sub
81
82