Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-1-Sonic-2-2013-Script-Decompilation
Path: blob/master/Sonic 2/Scripts/WFZ/EggmanShuttle.txt
1480 views
1
// ----------------------------------
2
// RSDK Project: Sonic 2
3
// Script Description: Eggman Shuttle 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
private alias object.value1 : object.scrollPos
14
15
// States
16
private alias 0 : WFZEGGMANSHUTTLE_AWAITPLAYER
17
private alias 1 : WFZEGGMANSHUTTLE_SCROLLING
18
19
// Modes
20
private alias 2 : MODE_TIMEATTACK
21
22
23
// ========================
24
// Events
25
// ========================
26
27
event ObjectUpdate
28
switch object.state
29
case WFZEGGMANSHUTTLE_AWAITPLAYER
30
BoxCollisionTest(C_TOUCH, object.entityPos, 0, -128, 384, 128, 0, C_BOX, C_BOX, C_BOX, C_BOX)
31
if checkResult == true
32
stage.activeLayer[1] = 2
33
object.priority = PRIORITY_ACTIVE
34
object.drawOrder = 2
35
object.scrollPos = -0x2FF0000
36
object.xpos += 0x1000000
37
hParallax[4].scrollPos = object.scrollPos
38
object.state++
39
end if
40
break
41
42
case WFZEGGMANSHUTTLE_SCROLLING
43
object.xvel += 0x600
44
if object.xvel > 0x80000
45
object.xvel = 0x80000
46
end if
47
object.scrollPos -= object.xvel
48
object.xpos += object.xvel
49
hParallax[4].scrollPos = object.scrollPos
50
51
object.timer++
52
if object.timer == 480
53
stage.activeLayer[1] = 9
54
hParallax[4].scrollPos = 0
55
tileLayer[2].scrollPos = 0
56
object.type = TypeName[Blank Object]
57
end if
58
break
59
60
end switch
61
end event
62
63
64
event ObjectDraw
65
temp0 = oscillation
66
temp0 += object.propertyValue
67
temp0 &= 1
68
if temp0 == 1
69
DrawSprite(0)
70
DrawSprite(1)
71
end if
72
end event
73
74
75
event ObjectStartup
76
LoadSpriteSheet("SCZ/Objects.gif")
77
SpriteFrame(-416, -78, 32, 28, 203, 90) // Same sprite twice, just with different offsets
78
SpriteFrame(-416, 50, 32, 28, 203, 90)
79
80
foreach (TypeName[Eggman Shuttle], arrayPos0, ALL_ENTITIES)
81
if options.gameMode == MODE_TIMEATTACK
82
ResetObjectEntity(arrayPos0, TypeName[Blank Object], 0, 0, 0)
83
end if
84
next
85
end event
86
87
88
// ========================
89
// Editor Events
90
// ========================
91
92
event RSDKEdit
93
if editor.returnVariable == true
94
switch editor.variableID
95
case EDIT_VAR_PROPVAL // property value
96
checkResult = object.propertyValue
97
break
98
99
case 0 // interval
100
checkResult = object.propertyValue
101
break
102
103
end switch
104
else
105
switch editor.variableID
106
case EDIT_VAR_PROPVAL // property value
107
object.propertyValue = editor.variableValue
108
break
109
110
case 0 // interval
111
object.propertyValue = editor.variableValue
112
break
113
114
end switch
115
end if
116
end event
117
118
119
event RSDKDraw
120
DrawSprite(0)
121
DrawSprite(1)
122
end event
123
124
125
event RSDKLoad
126
LoadSpriteSheet("SCZ/Objects.gif")
127
SpriteFrame(-416, -78, 32, 28, 203, 90)
128
SpriteFrame(-416, 50, 32, 28, 203, 90)
129
130
AddEditorVariable("interval")
131
SetActiveVariable("interval")
132
AddEnumVariable("Interval 1", 0)
133
AddEnumVariable("Interval 2", 1)
134
end event
135
136