Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/R4/ShootingFace.txt
1319 views
1
//--------------Sonic CD Shooting Face Script-----------------//
2
//--------Scripted by Christian Whitehead 'The Taxman'--------//
3
//-------Unpacked By Rubberduckycooly's Script Unpacker-------//
4
5
// Alias
6
#alias Object.Value0 : Object.Timer
7
8
// Face Projectile alias
9
#alias Object.XPos : FaceProjectile.XPos
10
#alias Object.YPos : FaceProjectile.YPos
11
#alias Object.Value1 : FaceProjectile.XVelocity
12
#alias Object.Direction : FaceProjectile.Direction
13
14
// Property Values
15
#alias 0 : LOOKING_RIGHT
16
#alias 1 : LOOKING_LEFT
17
18
19
sub ObjectMain
20
Object.Timer++
21
if Object.Timer == 32
22
Object.Timer = 0
23
CreateTempObject(TypeName[Face Projectile], 0, Object.XPos, Object.YPos)
24
if Object.PropertyValue == LOOKING_RIGHT
25
FaceProjectile[TempObjectPos].XPos += 0x100000
26
FaceProjectile[TempObjectPos].Direction = FACING_RIGHT
27
FaceProjectile[TempObjectPos].XVelocity = -0x30000
28
else
29
FaceProjectile[TempObjectPos].XPos -= 0x100000
30
FaceProjectile[TempObjectPos].Direction = FACING_LEFT
31
FaceProjectile[TempObjectPos].XVelocity = 0x30000
32
end if
33
FaceProjectile[TempObjectPos].YPos += 0x40000
34
end if
35
end sub
36
37
38
sub ObjectDraw
39
DrawSprite(Object.PropertyValue)
40
end sub
41
42
43
sub ObjectStartup
44
LoadSpriteSheet("R4/Objects2.gif")
45
46
SpriteFrame(-8, -16, 16, 32, 118, 151) // #0 - Face Projectile facing left
47
SpriteFrame(-8, -16, 16, 32, 135, 151) // #1 - Face Projectile facing right
48
49
// Used to be below LoadSpriteSheet, moved here for consistency
50
ArrayPos0 = 32
51
while ArrayPos0 < 1056
52
if Object[ArrayPos0].Type == TypeName[Shooting Face]
53
Object[ArrayPos0].DrawOrder = 4
54
end if
55
ArrayPos0++
56
loop
57
end sub
58
59
60
// ========================
61
// Editor Subs
62
// ========================
63
64
sub RSDKEdit
65
if Editor.ReturnVariable == true
66
switch Editor.VariableID
67
case EDIT_VAR_PROPVAL // Property Value
68
CheckResult = Object.PropertyValue
69
break
70
case 0 // blocks
71
CheckResult = Object.PropertyValue
72
break
73
end switch
74
else
75
switch Editor.VariableID
76
case EDIT_VAR_PROPVAL // Property Value
77
Object.PropertyValue = Editor.VariableValue
78
break
79
case 0 // blocks
80
Object.PropertyValue = Editor.VariableValue
81
break
82
end switch
83
end if
84
end sub
85
86
87
sub RSDKDraw
88
DrawSprite(Object.PropertyValue)
89
end sub
90
91
92
sub RSDKLoad
93
LoadSpriteSheet("R4/Objects2.gif")
94
95
SpriteFrame(-8, -16, 16, 32, 118, 151) // #0 - Face Projectile facing left
96
SpriteFrame(-8, -16, 16, 32, 135, 151) // #1 - Face Projectile facing right
97
98
AddEditorVariable("direction")
99
SetActiveVariable("direction")
100
AddEnumVariable("Facing left", 0)
101
AddEnumVariable("Facing right", 1)
102
end sub
103
104