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/GrabPanelPart.txt
1478 views
1
// ----------------------------------
2
// RSDK Project: Sonic 2
3
// Script Description: Grab Panel Part 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.frameTablePos
13
14
// States
15
private alias 0 : GRABPANELPART_DELAYED
16
private alias 1 : GRABPANELPART_ACTIVE
17
18
19
// ========================
20
// Tables
21
// ========================
22
23
private table GrabPanelPart_frameTable
24
5, 4, 2, 1, 3, 1, 2, 4, 5, 0
25
end table
26
27
private table GrabPanelPart_directionTable
28
1, 1, 1, 1, 0
29
0, 0, 0, 0, 0
30
end table
31
32
// Just the standard direction table, but flipped
33
private table GrabPanelPart_missionDirTable
34
0, 0, 0, 0, 0
35
1, 1, 1, 1, 0
36
end table
37
38
39
// ========================
40
// Events
41
// ========================
42
43
event ObjectUpdate
44
if object.state == GRABPANELPART_ACTIVE
45
object.xpos += object.xvel
46
object.ypos += object.yvel
47
object.yvel += 0x800
48
49
object.animationTimer++
50
if object.animationTimer == 4
51
object.animationTimer = 0
52
53
object.frameTablePos++
54
if object.frameTablePos >= 10
55
object.frameTablePos = 0
56
end if
57
GetTableValue(object.frame, object.frameTablePos, GrabPanelPart_frameTable)
58
#platform: USE_STANDALONE
59
GetTableValue(object.direction, object.frameTablePos, GrabPanelPart_directionTable)
60
#endplatform
61
#platform: USE_ORIGINS
62
if game.playMode != BOOT_PLAYMODE_MISSION
63
GetTableValue(object.direction, object.frameTablePos, GrabPanelPart_directionTable)
64
else
65
GetTableValue(object.direction, object.frameTablePos, GrabPanelPart_missionDirTable)
66
end if
67
#endplatform
68
end if
69
else
70
object.propertyValue--
71
if object.propertyValue == 0
72
object.state = GRABPANELPART_ACTIVE
73
end if
74
end if
75
76
if object.outOfBounds == true
77
object.type = TypeName[Blank Object]
78
end if
79
end event
80
81
82
event ObjectDraw
83
DrawSpriteFX(object.frame, FX_FLIP, object.xpos, object.ypos)
84
end event
85
86
87
event ObjectStartup
88
LoadSpriteSheet("SCZ/Objects.gif")
89
SpriteFrame(-16, -16, 32, 32, 1, 69)
90
SpriteFrame(-8, -16, 16, 32, 66, 92)
91
SpriteFrame(-4, -16, 8, 32, 83, 92)
92
SpriteFrame(-16, -16, 32, 32, 66, 125)
93
SpriteFrame(-4, -16, 8, 32, 92, 92)
94
SpriteFrame(-8, -16, 16, 32, 101, 92)
95
end event
96
97
98
// ========================
99
// Editor Events
100
// ========================
101
102
event RSDKDraw
103
DrawSprite(0)
104
end event
105
106
107
event RSDKLoad
108
LoadSpriteSheet("SCZ/Objects.gif")
109
SpriteFrame(-16, -16, 32, 32, 1, 69)
110
111
SetVariableAlias(ALIAS_VAR_PROPVAL, "delay")
112
end event
113
114