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/Enemies/SmallTurtloid.txt
1483 views
1
// ----------------------------------
2
// RSDK Project: Sonic 2
3
// Script Description: SmallTurtloid 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.value1 : object.parent
13
14
// Player aliases
15
private alias object.value40 : player.hitboxLeft
16
private alias object.value38 : player.hitboxTop
17
private alias object.value41 : player.hitboxRight
18
private alias object.value39 : player.hitboxBottom
19
20
// ========================
21
// Function Declarations
22
// ========================
23
24
reserve function SmallTurtloid_DebugDraw
25
reserve function SmallTurtloid_DebugSpawn
26
27
private function SmallTurtloid_DebugDraw
28
DrawSprite(2)
29
end function
30
31
32
private function SmallTurtloid_DebugSpawn
33
CreateTempObject(TypeName[SmallTurtloid], 0, object.xpos, object.ypos)
34
end function
35
36
37
// ========================
38
// Events
39
// ========================
40
41
event ObjectUpdate
42
if object.parent > 0
43
arrayPos0 = object.parent
44
object.xpos = object[arrayPos0].xpos
45
object.xpos += 0x40000
46
object.ypos = object[arrayPos0].ypos
47
object.ypos -= 0x180000
48
end if
49
50
foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)
51
BoxCollisionTest(C_TOUCH, object.entityPos, -12, -12, 12, 12, currentPlayer, player[currentPlayer].hitboxLeft, player[currentPlayer].hitboxTop, player[currentPlayer].hitboxRight, player[currentPlayer].hitboxBottom)
52
if checkResult == true
53
CallFunction(Player_BadnikBreak)
54
end if
55
next
56
end event
57
58
59
event ObjectDraw
60
DrawSprite(object.frame)
61
temp0 = object.frame
62
temp0 += 2
63
DrawSprite(temp0)
64
end event
65
66
67
event ObjectStartup
68
CheckCurrentStageFolder("Zone10")
69
if checkResult == true
70
LoadSpriteSheet("SCZ/Objects.gif")
71
SpriteFrame(-12, -11, 24, 23, 186, 42)
72
SpriteFrame(-12, -11, 24, 23, 211, 42)
73
SpriteFrame(-12, -11, 24, 23, 186, 66)
74
SpriteFrame(-12, -11, 24, 23, 211, 66)
75
else
76
LoadSpriteSheet("MBZ/Objects.gif")
77
SpriteFrame(-12, -11, 24, 23, 186, 42)
78
SpriteFrame(-12, -11, 24, 23, 211, 42)
79
SpriteFrame(-12, -11, 24, 23, 186, 66)
80
SpriteFrame(-12, -11, 24, 23, 211, 66)
81
end if
82
83
foreach (TypeName[SmallTurtloid], arrayPos0, ALL_ENTITIES)
84
arrayPos1 = arrayPos0
85
arrayPos1--
86
if object[arrayPos1].type == TypeName[Big Turtloid]
87
object[arrayPos0].parent = arrayPos1
88
else
89
object[arrayPos0].parent = 0
90
end if
91
next
92
93
SetTableValue(TypeName[SmallTurtloid], DebugMode_ObjCount, DebugMode_TypesTable)
94
SetTableValue(SmallTurtloid_DebugDraw, DebugMode_ObjCount, DebugMode_DrawTable)
95
SetTableValue(SmallTurtloid_DebugSpawn, DebugMode_ObjCount, DebugMode_SpawnTable)
96
DebugMode_ObjCount++
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("Zone10")
111
if checkResult == true
112
LoadSpriteSheet("SCZ/Objects.gif")
113
SpriteFrame(-12, -11, 24, 23, 186, 42)
114
SpriteFrame(-12, -11, 24, 23, 211, 42)
115
SpriteFrame(-12, -11, 24, 23, 186, 66)
116
SpriteFrame(-12, -11, 24, 23, 211, 66)
117
else
118
LoadSpriteSheet("MBZ/Objects.gif")
119
SpriteFrame(-12, -11, 24, 23, 186, 42)
120
SpriteFrame(-12, -11, 24, 23, 211, 42)
121
SpriteFrame(-12, -11, 24, 23, 186, 66)
122
SpriteFrame(-12, -11, 24, 23, 211, 66)
123
end if
124
125
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
126
end event
127
128