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/MechaSonicSpike.txt
1482 views
1
// ----------------------------------
2
// RSDK Project: Sonic 2
3
// Script Description: MechaSonicSpike Object
4
// Script Author: Christian Whitehead/Simon Thomley
5
// Unpacked by Rubberduckycooly's script unpacker
6
// ----------------------------------
7
8
// ========================
9
// Events
10
// ========================
11
12
event ObjectUpdate
13
object.xpos += object.xvel
14
object.ypos += object.yvel
15
16
if object.outOfBounds == true
17
// Unload if out of bounds
18
object.type = TypeName[Blank Object]
19
end if
20
21
// Check collision with players
22
foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)
23
BoxCollisionTest(C_TOUCH, object.entityPos, -4, -4, 4, 4, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)
24
if checkResult == true
25
CallFunction(Player_Hit)
26
end if
27
next
28
end event
29
30
31
event ObjectDraw
32
DrawSprite(object.frame)
33
end event
34
35
36
event ObjectStartup
37
// Interestingly, even though the correct sprites are present on the sheet, this object forgoes using the MBZ sprites even when in MBZ
38
LoadSpriteSheet("DEZ/Objects.gif")
39
40
SpriteFrame(-4, -8, 7, 16, 296, 50) // Pointing up
41
SpriteFrame(-5, -5, 13, 13, 304, 50) // Upwards-left
42
SpriteFrame(-8, -3, 16, 7, 318, 50) // Left
43
SpriteFrame(-5, -8, 13, 13, 335, 50) // Down-left
44
SpriteFrame(-4, -8, 7, 16, 349, 50) // Down
45
SpriteFrame(-8, -8, 13, 13, 357, 50) // Down-right
46
SpriteFrame(-8, -3, 16, 7, 371, 50) // Right
47
SpriteFrame(-8, -5, 13, 13, 388, 50) // Up-right
48
end event
49
50
51
// ========================
52
// Editor Events
53
// ========================
54
55
event RSDKDraw
56
DrawSprite(0)
57
end event
58
59
60
event RSDKLoad
61
CheckCurrentStageFolder("Zone12")
62
if checkResult == true
63
LoadSpriteSheet("DEZ/Objects.gif")
64
SpriteFrame(-4, -8, 7, 16, 296, 50)
65
else
66
// Decomp note - may as well, y'know?
67
// Who knows, it might even help initial editor load times a tad bit
68
LoadSpriteSheet("MBZ/Objects.gif")
69
SpriteFrame(-4, -8, 7, 16, 808, 50)
70
end if
71
72
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
73
end event
74
75