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