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/HTZ/LavaBubble.txt
1480 views
1
// ----------------------------------
2
// RSDK Project: Sonic 2
3
// Script Description: Lava Bubble 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 0 : LAVABUBBLE_BUBBLING
13
private alias 1 : LAVABUBBLE_DISSIPATED
14
15
16
// ========================
17
// Function Declarations
18
// ========================
19
20
reserve function LavaBubble_DebugDraw
21
reserve function LavaBubble_DebugSpawn
22
23
24
// ========================
25
// Function Definitions
26
// ========================
27
28
private function LavaBubble_DebugDraw
29
DrawSprite(0)
30
end function
31
32
33
private function LavaBubble_DebugSpawn
34
CreateTempObject(TypeName[Lava Bubble], 0, object.xpos, object.ypos)
35
end function
36
37
38
// ========================
39
// Events
40
// ========================
41
42
event ObjectUpdate
43
if object.state == LAVABUBBLE_BUBBLING
44
object.animationTimer++
45
if object.animationTimer >= 13
46
object.animationTimer = 0
47
object.frame++
48
if object.frame == 3
49
object.frame = 0
50
object.state = LAVABUBBLE_DISSIPATED
51
end if
52
end if
53
54
if object.frame == 2
55
if object.animationTimer == 8
56
PlaySfx(SfxName[Small Fireball], false)
57
CreateTempObject(TypeName[Lava Jump], 0, object.xpos, object.ypos)
58
object[tempObjectPos].xvel = -0x1C000
59
object[tempObjectPos].yvel = -0x60000
60
61
CreateTempObject(TypeName[Lava Jump], 0, object.xpos, object.ypos)
62
object[tempObjectPos].xvel = 0x1C000
63
object[tempObjectPos].yvel = -0x60000
64
object[tempObjectPos].direction = FACING_LEFT
65
end if
66
end if
67
else
68
object.animationTimer++
69
if object.animationTimer >= 60
70
object.animationTimer = 0
71
object.state = LAVABUBBLE_BUBBLING
72
end if
73
end if
74
end event
75
76
77
event ObjectDraw
78
if object.state == LAVABUBBLE_BUBBLING
79
DrawSprite(object.frame)
80
end if
81
end event
82
83
84
event ObjectStartup
85
CheckCurrentStageFolder("Zone05")
86
if checkResult == true
87
LoadSpriteSheet("HTZ/Objects.gif")
88
SpriteFrame(-8, -2, 16, 11, 124, 110)
89
SpriteFrame(-8, -5, 16, 11, 141, 110)
90
SpriteFrame(-8, -7, 16, 13, 158, 108)
91
else
92
LoadSpriteSheet("MBZ/Objects.gif")
93
94
// These frames don't really match up, they're just the HTZ sheet pos
95
SpriteFrame(-8, -2, 16, 11, 125, 110)
96
SpriteFrame(-8, -5, 16, 11, 141, 110)
97
SpriteFrame(-8, -7, 16, 13, 158, 108)
98
end if
99
100
SetTableValue(TypeName[Lava Bubble], DebugMode_ObjCount, DebugMode_TypesTable)
101
SetTableValue(LavaBubble_DebugDraw, DebugMode_ObjCount, DebugMode_DrawTable)
102
SetTableValue(LavaBubble_DebugSpawn, DebugMode_ObjCount, DebugMode_SpawnTable)
103
DebugMode_ObjCount++
104
end event
105
106
107
// ========================
108
// Editor Events
109
// ========================
110
111
event RSDKDraw
112
DrawSprite(0)
113
end event
114
115
116
event RSDKLoad
117
CheckCurrentStageFolder("Zone05")
118
if checkResult == true
119
LoadSpriteSheet("HTZ/Objects.gif")
120
SpriteFrame(-8, -2, 16, 11, 124, 110)
121
else
122
LoadSpriteSheet("MBZ/Objects.gif")
123
SpriteFrame(-8, -2, 16, 11, 125, 110)
124
end if
125
126
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
127
end event
128
129