Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/R3/EBarrier.txt
1319 views
1
//---------------Sonic CD Eggman Barrier Script---------------//
2
//--------Scripted by Christian Whitehead 'The Taxman'--------//
3
//-------Unpacked By Rubberduckycooly's Script Unpacker-------//
4
5
// Aliases
6
#alias Object.Value0 : Object.Timer
7
8
// States
9
#alias 0 : EBARRIER_IDLE
10
#alias 1 : EBARRIER_HIT
11
#alias 2 : EBARRIER_DESTROYED
12
13
// Global SFX
14
#alias 22 : SFX_G_EXPLOSION
15
16
17
sub ObjectMain
18
switch Object.State
19
case EBARRIER_HIT
20
if Object.YPos > 0x5100000
21
Object.YPos -= 0x28000
22
else
23
Object.YPos = 0x5100000
24
Object.State = EBARRIER_DESTROYED
25
26
#platform: Use_Haptics
27
HapticEffect(76, 0, 0, 0)
28
#endplatform
29
30
end if
31
Object.Frame++
32
Object.Frame %= 9
33
break
34
35
case EBARRIER_DESTROYED
36
TempValue0 = Object.Timer
37
TempValue0 &= 3
38
if TempValue0 == 0
39
40
Rand(TempValue0, 96)
41
TempValue0 -= 48
42
TempValue0 <<= 16
43
TempValue0 += Object.XPos
44
45
Rand(TempValue1, 40)
46
TempValue1 -= 20
47
TempValue1 <<= 16
48
TempValue1 += Object.YPos
49
50
CreateTempObject(TypeName[Explosion], 0, TempValue0, TempValue1)
51
PlaySfx(SFX_G_EXPLOSION, false)
52
end if
53
54
Object.Timer++
55
if Object.Timer == 120
56
Object.Type = TypeName[Blank Object]
57
end if
58
break
59
end switch
60
end sub
61
62
63
sub ObjectPlayerInteraction
64
if Object.State == EBARRIER_IDLE
65
PlayerObjectCollision(C_TOUCH, -48, -16, 48, 16)
66
if CheckResult == true
67
Object.State = EBARRIER_HIT
68
Player.YVelocity = 0
69
PlaySfx(SFX_G_EXPLOSION, false)
70
end if
71
end if
72
end sub
73
74
75
sub ObjectDraw
76
DrawSprite(3)
77
78
TempValue0 = Object.Frame
79
TempValue0 /= 3
80
DrawSprite(TempValue0)
81
end sub
82
83
84
sub ObjectStartup
85
LoadSpriteSheet("R3/Objects2.gif")
86
87
SpriteFrame(-64, -16, 32, 32, 134, 0) // #0 - Gear Frame 0
88
SpriteFrame(-64, -16, 32, 32, 167, 0) // #1 - Gear Frame 1
89
SpriteFrame(-64, -16, 32, 32, 200, 0) // #2 - Gear Frame 2
90
91
SpriteFrame(-48, -16, 96, 32, 1, 67) // #3 - Eggman Barrier
92
end sub
93
94
95
// ========================
96
// Editor Subs
97
// ========================
98
99
sub RSDKDraw
100
DrawSprite(0)
101
DrawSprite(1)
102
end sub
103
104
105
sub RSDKLoad
106
LoadSpriteSheet("R3/Objects2.gif")
107
108
SpriteFrame(-64, -16, 32, 32, 134, 0) // #0 - Gear Frame 0
109
SpriteFrame(-48, -16, 96, 32, 1, 67) // #3 - Eggman Barrier
110
111
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
112
end sub
113
114