Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-CD-2011-Script-Decompilation
Path: blob/main/Scripts/R7/InvisibleBarrier.txt
1319 views
1
//---------------Sonic CD Tails Barrier Script----------------//
2
//--------Scripted by Christian Whitehead 'The Taxman'--------//
3
//-------Unpacked By Rubberduckycooly's Script Unpacker-------//
4
5
// Aliases
6
7
// Player Aliases
8
#alias 0 : PLAYER_SONIC_A
9
10
11
sub ObjectPlayerInteraction
12
// This collision box is only for the first layer
13
if PathSwap_Flag == 0
14
PlayerObjectCollision(C_TOUCH, -16, -14, 16, 16)
15
16
if CheckResult == true
17
if Player.XPos < Object.XPos
18
// The player is to the left of the barrier, push the player out to the left
19
Player.XPos = Player.CollisionLeft
20
Player.XPos <<= 16
21
Player.XPos += Object.XPos
22
Player.XPos -= 0x100000 // moving the player 16 pixels left
23
else
24
// Player's to the right of the barrier, puch them to the right instead
25
Player.XPos = Player.CollisionRight
26
Player.XPos <<= 16
27
Player.XPos += Object.XPos
28
Player.XPos += 0x100000 // move the player 16 pixels right
29
end if
30
31
Player.Speed = 0
32
Player.XVelocity = 0
33
end if
34
end if
35
36
end sub
37
38
39
sub ObjectStartup
40
41
if Stage.PlayerListPos == PLAYER_SONIC_A // PLAYER_SONIC in origins
42
43
// I have no idea what this is doing to be honest
44
// It's formatted like an object setup but... there's no setup actually happening...
45
// And the fact it's only for Sonic too for whatever reason... certainly strange
46
47
ArrayPos0 = 32
48
while ArrayPos0 < 1056
49
// something???
50
// Given that the name of the object is "*Tails* Barrier" though, perhaps it was just gonna unload itself here?
51
ArrayPos0++
52
loop
53
54
end if
55
56
end sub
57
58
59
// ========================
60
// Editor Subs
61
// ========================
62
63
sub RSDKDraw
64
DrawSprite(0)
65
66
// Draw the hitbox for the object
67
68
TempValue0 = Object.iXPos
69
TempValue0 -= 16
70
TempValue1 = Object.iYPos
71
TempValue1 -= 14
72
DrawRectOutline(TempValue0, TempValue1, 32, 30, 255, 255, 255, 255)
73
end sub
74
75
76
sub RSDKLoad
77
LoadSpriteSheet("Global/Display.gif")
78
SpriteFrame(-16, -14, 32, 30, 1, 145) // "Script" Icon - I don't feel like it's an ideal fit here, but I can't think of anything else...
79
80
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
81
end sub
82
83