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/Mission/BallHogBomb2.txt
1483 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
// This script is a copy of the normal Ball Hog Bomb script but with tile collisions removed so that Ball Hogs can be placed on Mission Blocks
9
10
// ========================
11
// Aliases
12
// ========================
13
14
private alias object.value0 : object.time // Set by Ball Hog object when creating this projectile
15
private alias object.value1 : object.bouncePos // new Ball Hog Bomb 2 value
16
17
// Path ID Aliases
18
private alias 0 : PATH_A
19
20
21
// ========================
22
// Events
23
// ========================
24
25
event ObjectUpdate
26
object.xpos += object.xvel
27
object.ypos += object.yvel
28
object.yvel += 0x3800
29
30
if object.yvel > 0
31
// This bit is a new Ball Hog Bomb 2 bit - instead of checking for tile collisions here, let's just see if the object is below its bounce threshold
32
// temp0 doesn't really need to be used here but it was used in the base bomb script so i guess they just wanted to stick with that?
33
temp0 = object.ypos
34
if temp0 >= object.bouncePos
35
object.yvel = -0x30000
36
end if
37
38
// ..if we're going right, then check left wall collision?
39
// (this bit is new to the Ball Hog Bomb 2 script too, it's not in the normal version)
40
if object.xvel > 0
41
ObjectTileGrip(CSIDE_LWALL, 8, 0, PATH_A)
42
if checkResult != false
43
FlipSign(object.xvel)
44
end if
45
end if
46
end if
47
48
foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)
49
BoxCollisionTest(C_TOUCH, object.entityPos, -6, -6, 6, 6, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)
50
if checkResult == true
51
CallFunction(Player_Hit)
52
end if
53
next
54
55
object.animationTimer++
56
if object.animationTimer >= 6
57
object.frame ^= 1
58
object.animationTimer = 0
59
end if
60
61
// Update the bomb's countdown timer
62
if object.time > 0
63
object.time--
64
else
65
// Explode the bomb
66
ResetObjectEntity(object.entityPos, TypeName[Blank Object], 0, object.xpos, object.ypos)
67
CreateTempObject(TypeName[Explosion], 0, object.xpos, object.ypos)
68
object[tempObjectPos].drawOrder = 4
69
PlaySfx(SfxName[Explosion], false)
70
end if
71
end event
72
73
74
event ObjectDraw
75
DrawSpriteFX(object.frame, FX_FLIP, object.xpos, object.ypos)
76
end event
77
78
79
event ObjectStartup
80
CheckCurrentStageFolder("Zone06")
81
if checkResult == true
82
LoadSpriteSheet("SBZ/Objects.gif")
83
SpriteFrame(-7, -7, 14, 14, 82, 126)
84
SpriteFrame(-7, -7, 14, 14, 82, 143)
85
end if
86
87
CheckCurrentStageFolder("Zone07")
88
if checkResult == true
89
LoadSpriteSheet("MBZ/Objects.gif")
90
SpriteFrame(-7, -7, 14, 14, 165, 248)
91
SpriteFrame(-7, -7, 14, 14, 182, 248)
92
end if
93
end event
94
95
96
// ========================
97
// Editor Events
98
// ========================
99
100
event RSDKDraw
101
DrawSprite(0)
102
end event
103
104
105
event RSDKLoad
106
CheckCurrentStageFolder("Zone07")
107
if checkResult == true
108
LoadSpriteSheet("MBZ/Objects.gif")
109
SpriteFrame(-7, -7, 14, 14, 165, 248)
110
else
111
LoadSpriteSheet("SBZ/Objects.gif")
112
SpriteFrame(-7, -7, 14, 14, 82, 126)
113
end if
114
115
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
116
end event
117
118