Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-1-Sonic-2-2013-Script-Decompilation
Path: blob/master/Sonic 1/Scripts/Global/Invincibility.txt
1480 views
1
// ----------------------------------
2
// RSDK Project: Sonic 1
3
// Script Description: Invincibility Object
4
// Script Author: Christian Whitehead/Simon Thomley
5
// Unpacked by Rubberduckycooly's script unpacker
6
// ----------------------------------
7
8
// ========================
9
// Aliases
10
// ========================
11
12
private alias object.value0 : object.timer
13
14
private alias 0 : INVINCIBILITY_SPAWNER
15
private alias 1 : INVINCIBILITY_SPARKLES
16
17
// Player Aliases
18
private alias object.value18 : player.sortedDrawOrder
19
20
21
// ========================
22
// Events
23
// ========================
24
25
event ObjectUpdate
26
if object.state == INVINCIBILITY_SPAWNER
27
// Bug Details:
28
// - In the original 2013 release of S1 this was meant to be an invalid Draw Order,
29
// separate from the -1 of DRAWORDER_PLAYER
30
// - In Origins however, they turned Draw Order 7 into a real thing, retroactively turning this into an actually valid thing...
31
// It's nothing too major at all, but just something interesting of note
32
object.drawOrder = 7
33
34
object.timer++
35
if object.timer > 3
36
object.timer = 0
37
CreateTempObject(TypeName[Invincibility], 0, object[-playerCount].xpos, object[-playerCount].ypos)
38
object[tempObjectPos].state = INVINCIBILITY_SPARKLES
39
object[tempObjectPos].inkEffect = INK_ALPHA
40
object[tempObjectPos].alpha = 256
41
object[tempObjectPos].drawOrder = player[-playerCount].sortedDrawOrder
42
end if
43
44
object.frame = ringFrame
45
object.frame &= 3
46
else
47
object.frame = ringFrame
48
object.frame &= 3
49
object.alpha -= 8
50
if object.alpha == 120
51
object.type = TypeName[Blank Object]
52
end if
53
end if
54
end event
55
56
57
event ObjectDraw
58
switch object.state
59
case INVINCIBILITY_SPAWNER
60
if object.timer == 0
61
DrawSpriteXY(object.frame, object[-playerCount].xpos, object[-playerCount].ypos)
62
end if
63
break
64
65
case INVINCIBILITY_SPARKLES
66
object.alpha += 8
67
DrawSpriteFX(object.frame, FX_INK, object.xpos, object.ypos)
68
object.alpha -= 8
69
break
70
71
end switch
72
end event
73
74
75
event ObjectStartup
76
LoadSpriteSheet("Global/Items.gif")
77
78
SpriteFrame(-24, -24, 48, 48, 207, 1)
79
SpriteFrame(-24, -24, 48, 48, 207, 50)
80
SpriteFrame(-24, -24, 48, 48, 207, 99)
81
SpriteFrame(-24, -24, 48, 48, 207, 148)
82
end event
83
84
85
// ========================
86
// Editor Events
87
// ========================
88
89
event RSDKDraw
90
DrawSprite(0)
91
end event
92
93
94
event RSDKLoad
95
LoadSpriteSheet("Global/Items.gif")
96
SpriteFrame(-24, -24, 48, 48, 207, 1)
97
98
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
99
end event
100
101