Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/R4/PushButton.txt
1319 views
1
//-----------------Sonic CD Push Button Script----------------//
2
//--------Scripted by Christian Whitehead 'The Taxman'--------//
3
//-------Unpacked By Rubberduckycooly's Script Unpacker-------//
4
5
// Aliases
6
#alias Object.PropertyValue : Object.Pressed
7
8
// Gravity
9
#alias 0 : GRAVITY_GROUND
10
11
// Stage SFX
12
#alias 8 : SFX_S_SWITCH
13
14
15
sub ObjectPlayerInteraction
16
if Object.Pressed == false
17
if Player.YVelocity >= 0
18
PlayerObjectCollision(C_BOX, -16, -8, 16, 8)
19
if CheckResult == true
20
Object.Pressed = true
21
Player.YPos += 0x80000
22
PlayStageSfx(SFX_S_SWITCH, false)
23
else
24
Object.Pressed = false
25
end if
26
else
27
Object.Pressed = false
28
end if
29
else
30
PlayerObjectCollision(C_TOUCH, -16, -2, 16, 8)
31
if CheckResult == true
32
if Player.YVelocity > -1
33
Object.Pressed = true
34
Player.Gravity = GRAVITY_GROUND
35
Player.YVelocity = 0
36
37
Player.YPos = Player.CollisionBottom
38
FlipSign(Player.YPos)
39
Player.YPos <<= 16
40
Player.YPos += Object.YPos
41
end if
42
else
43
Object.Pressed = false
44
if Player.YVelocity > -1
45
Player.Gravity = GRAVITY_GROUND
46
Player.YVelocity = 0
47
48
Player.YPos = Player.CollisionBottom
49
FlipSign(Player.YPos)
50
Player.YPos -= 8
51
Player.YPos <<= 16
52
Player.YPos += Object.YPos
53
end if
54
end if
55
end if
56
end sub
57
58
59
sub ObjectDraw
60
DrawSprite(Object.Pressed)
61
end sub
62
63
64
sub ObjectStartup
65
LoadSpriteSheet("R4/Objects.gif")
66
67
SpriteFrame(-16, -8, 32, 16, 130, 35) // #0 - Push Button
68
SpriteFrame(-16, -8, 32, 16, 130, 52) // #1 - Push Button pressed
69
end sub
70
71
72
// ========================
73
// Editor Subs
74
// ========================
75
76
sub RSDKDraw
77
DrawSprite(0)
78
end sub
79
80
81
sub RSDKLoad
82
LoadSpriteSheet("R4/Objects.gif")
83
84
SpriteFrame(-16, -8, 32, 16, 130, 35) // #0 - Push Button
85
86
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
87
end sub
88
89