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/Enemies/BallHogBomb.txt
1482 views
1
// ----------------------------------
2
// RSDK Project: Sonic 1
3
// Script Description: Ball Hog 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.time // Set by Ball Hog object when creating this projectile
13
14
// Path ID Aliases
15
private alias 0 : PATH_A
16
17
18
// ========================
19
// Events
20
// ========================
21
22
event ObjectUpdate
23
object.xpos += object.xvel
24
object.ypos += object.yvel
25
object.yvel += 0x3800
26
27
if object.yvel > 0
28
temp0 = object.ypos
29
30
ObjectTileCollision(CSIDE_FLOOR, 0, 8, PATH_A)
31
if checkResult == true
32
object.yvel = -0x30000
33
object.ypos = temp0
34
ObjectTileGrip(CSIDE_FLOOR, -2, 8, PATH_A)
35
temp1 = object.ypos
36
object.ypos = temp0
37
ObjectTileGrip(CSIDE_FLOOR, 2, 8, PATH_A)
38
temp2 = object.ypos
39
object.ypos = temp0
40
if object.xvel > 0
41
if temp2 < temp1
42
FlipSign(object.xvel)
43
end if
44
else
45
if temp1 < temp2
46
FlipSign(object.xvel)
47
end if
48
end if
49
end if
50
end if
51
52
foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)
53
BoxCollisionTest(C_TOUCH, object.entityPos, -6, -6, 6, 6, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)
54
if checkResult == true
55
CallFunction(Player_Hit)
56
end if
57
next
58
59
object.animationTimer++
60
if object.animationTimer >= 6
61
object.frame ^= 1
62
object.animationTimer = 0
63
end if
64
65
// Update the bomb's countdown timer
66
if object.time > 0
67
object.time--
68
else
69
// Explode the bomb
70
ResetObjectEntity(object.entityPos, TypeName[Blank Object], 0, object.xpos, object.ypos)
71
CreateTempObject(TypeName[Explosion], 0, object.xpos, object.ypos)
72
object[tempObjectPos].drawOrder = 4
73
PlaySfx(SfxName[Explosion], false)
74
end if
75
end event
76
77
78
event ObjectDraw
79
DrawSpriteFX(object.frame, FX_FLIP, object.xpos, object.ypos)
80
end event
81
82
83
event ObjectStartup
84
CheckCurrentStageFolder("Zone06")
85
if checkResult == true
86
LoadSpriteSheet("SBZ/Objects.gif")
87
SpriteFrame(-7, -7, 14, 14, 82, 126)
88
SpriteFrame(-7, -7, 14, 14, 82, 143)
89
end if
90
91
CheckCurrentStageFolder("Zone07")
92
if checkResult == true
93
LoadSpriteSheet("MBZ/Objects.gif")
94
SpriteFrame(-7, -7, 14, 14, 165, 248)
95
SpriteFrame(-7, -7, 14, 14, 182, 248)
96
end if
97
end event
98
99
100
// ========================
101
// Editor Events
102
// ========================
103
104
event RSDKDraw
105
DrawSprite(0)
106
end event
107
108
109
event RSDKLoad
110
CheckCurrentStageFolder("Zone07")
111
if checkResult == true
112
LoadSpriteSheet("MBZ/Objects.gif")
113
SpriteFrame(-7, -7, 14, 14, 165, 248)
114
else
115
LoadSpriteSheet("SBZ/Objects.gif")
116
SpriteFrame(-7, -7, 14, 14, 82, 126)
117
end if
118
119
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
120
end event
121
122