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/DEZ/DERBomb.txt
1482 views
1
// ----------------------------------
2
// RSDK Project: Sonic 2
3
// Script Description: DER Bomb 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.originPos.y
14
15
private alias 0 : DERBOMB_LAUNCHED
16
private alias 1 : DERBOMB_LANDED
17
private alias 2 : DERBOMB_EXPLODING
18
19
// Path ID Aliases
20
private alias 0 : PATH_A
21
22
23
// ========================
24
// Events
25
// ========================
26
27
event ObjectUpdate
28
switch object.state
29
case DERBOMB_LAUNCHED
30
object.xpos += object.xvel
31
object.ypos += object.yvel
32
object.yvel += 0x3800
33
34
// Only check for collision if lower than where it started from
35
// (If there's a roof, we don't want to land on it)
36
if object.ypos > object.originPos.y
37
ObjectTileCollision(CSIDE_FLOOR, 0, 16, PATH_A)
38
if checkResult == true
39
object.timer = 64
40
object.state = DERBOMB_LANDED
41
end if
42
end if
43
break
44
45
case DERBOMB_LANDED
46
object.timer--
47
if object.timer < 0
48
object.timer = 40
49
object.frame = 1
50
CreateTempObject(TypeName[Explosion], 0, object.xpos, object.ypos)
51
object[tempObjectPos].drawOrder = 5
52
PlaySfx(SfxName[Explosion], false)
53
object.state = DERBOMB_EXPLODING
54
end if
55
break
56
57
case DERBOMB_EXPLODING
58
object.timer--
59
if object.timer < 0
60
object.state = 0
61
object.frame = 0
62
object.type = TypeName[Blank Object]
63
end if
64
break
65
66
end switch
67
68
foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)
69
BoxCollisionTest(C_TOUCH, object.entityPos, -12, -16, 12, 16, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)
70
if checkResult == true
71
CallFunction(Player_Hit)
72
end if
73
next
74
end event
75
76
77
event ObjectDraw
78
DrawSprite(object.frame)
79
end event
80
81
82
event ObjectStartup
83
CheckCurrentStageFolder("Zone12")
84
if checkResult == true
85
LoadSpriteSheet("DEZ/Objects.gif")
86
87
// Aerial Bomb Frame
88
SpriteFrame(-14, -16, 28, 32, 401, 125)
89
90
// Grounded Bomb Frame
91
SpriteFrame(0, 0, 1, 1, 401, 125)
92
93
// Unused Bomb Shrapnel Frames
94
SpriteFrame(-4, -4, 8, 8, 356, 187)
95
SpriteFrame(-4, -4, 8, 8, 365, 187)
96
else
97
LoadSpriteSheet("MBZ/Objects.gif")
98
99
// Aerial Bomb Frame
100
SpriteFrame(-14, -16, 28, 32, 913, 125)
101
102
// Grounded Bomb Frame
103
SpriteFrame(0, 0, 1, 1, 913, 125)
104
105
// Unused Bomb Shrapnel Frames
106
SpriteFrame(-4, -4, 8, 8, 868, 187)
107
SpriteFrame(-4, -4, 8, 8, 877, 187)
108
end if
109
end event
110
111
112
// ========================
113
// Editor Events
114
// ========================
115
116
event RSDKDraw
117
DrawSprite(0)
118
end event
119
120
121
event RSDKLoad
122
CheckCurrentStageFolder("Zone12")
123
if checkResult == true
124
LoadSpriteSheet("DEZ/Objects.gif")
125
SpriteFrame(-14, -16, 28, 32, 401, 125)
126
else
127
LoadSpriteSheet("MBZ/Objects.gif")
128
SpriteFrame(-14, -16, 28, 32, 913, 125)
129
end if
130
131
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
132
end event
133
134