//---------------Sonic CD Tunnel Path 4 Script----------------//
//--------Scripted by Christian Whitehead 'The Taxman'--------//
//-------Unpacked By Rubberduckycooly's Script Unpacker-------//
// Aliases
#alias Object.Value0 : Object.MoveSteps
// Player Aliases
#alias Player.Value4 : Player.InvincibleTimer
#alias Player.Value5 : Player.BlinkTimer
// States
#alias 0 : TUNNELPATH_4_INACTIVE
#alias 1 : TUNNELPATH_4_ACTIVE
// Global SFX
#alias 7 : SFX_G_RELEASE
// Priority
#alias 0 : PRIORITY_BOUNDS
#alias 1 : PRIORITY_ACTIVE
sub ObjectMain
if Object.State == TUNNELPATH_4_ACTIVE
if Player.State == Player_State_Death
Object.State = TUNNELPATH_4_INACTIVE
end if
Object.MoveSteps++
Player.Speed = Player.XPos
Player.Animation = ANI_JUMPING
Player.AnimationSpeed = 240
switch Object.MoveSteps
case 0
Player.XPos = 0x8B00
Player.YPos = 0x8200
break
case 1
Player.XPos = 0x88B00
Player.YPos = 0x8200
break
case 2
Player.XPos = 0x88B00
Player.YPos = 0x88200
break
case 3
Player.XPos = 0x88B00
Player.YPos = 0x108200
break
case 4
Player.XPos = 0x88B00
Player.YPos = 0x188200
break
case 5
Player.XPos = 0x88B00
Player.YPos = 0x208200
break
case 6
Player.XPos = 0x88B00
Player.YPos = 0x288200
break
case 7
Player.XPos = 0x88B00
Player.YPos = 0x308200
break
case 8
Player.XPos = 0x88B00
Player.YPos = 0x388200
break
case 9
Player.XPos = 0x88B00
Player.YPos = 0x408200
break
case 10
Player.XPos = 0x88B00
Player.YPos = 0x488200
break
case 11
Player.XPos = 0x88B00
Player.YPos = 0x508200
break
case 12
Player.XPos = 0x88B00
Player.YPos = 0x588200
break
case 13
Player.XPos = 0x88B00
Player.YPos = 0x608200
break
case 14
Player.XPos = 0x88B00
Player.YPos = 0x688200
break
case 15
Player.XPos = 0x88B00
Player.YPos = 0x708200
break
case 16
Player.XPos = 0x88B00
Player.YPos = 0x788200
break
case 17
Player.XPos = 0x88B00
Player.YPos = 0x808200
break
case 18
Player.XPos = 0x88B00
Player.YPos = 0x888200
break
case 19
Player.XPos = 0x88B00
Player.YPos = 0x908200
break
case 20
Player.XPos = 0x88B00
Player.YPos = 0x988200
break
case 21
Player.XPos = 0x88B00
Player.YPos = 0xA08200
break
case 22
Player.XPos = 0x88B00
Player.YPos = 0xA88200
break
case 23
Player.XPos = 0x88B00
Player.YPos = 0xB08200
break
case 24
Player.XPos = 0x88B00
Player.YPos = 0xB88200
break
case 25
Player.XPos = 0x88B00
Player.YPos = 0xC08200
break
case 26
Player.XPos = 0x88B00
Player.YPos = 0xC88200
break
case 27
Player.XPos = 0x88B00
Player.YPos = 0xD08200
break
case 28
Player.XPos = 0x88B00
Player.YPos = 0xD88200
break
case 29
Player.XPos = 0x88B00
Player.YPos = 0xE08200
break
case 30
Player.XPos = 0x88B00
Player.YPos = 0xE88200
break
case 31
Player.XPos = 0x88B00
Player.YPos = 0xF08200
break
case 32
Player.XPos = 0x88B00
Player.YPos = 0xF88200
break
case 33
Player.XPos = 0x88B00
Player.YPos = 0x1008200
break
case 34
Player.XPos = 0x108B00
Player.YPos = 0x1008200
break
case 35
Player.XPos = 0x188B00
Player.YPos = 0x1008200
break
case 36
Player.ObjectInteraction = true
Player.XPos = 0x208B00
Player.YPos = 0x1008200
break
case 37
Player.XPos = 0x288B00
Player.YPos = 0x1008200
break
case 38
Player.XPos = 0x308B00
Player.YPos = 0x1008200
break
case 39
Player.XPos = 0x388B00
Player.YPos = 0x1008200
break
case 40
Player.XPos = 0x408B00
Player.YPos = 0x1008200
Player.Direction = FACING_RIGHT
Object.State = TUNNELPATH_4_INACTIVE
Object.Priority = PRIORITY_BOUNDS
Player.XVelocity = 0x80000
Player.Speed = 0x80000
Player.YVelocity = 0
#platform: Use_Origins
Player.State = Player_State_Air_NoDropDash
#endplatform
#platform: Use_Standalone
Player.State = Player_State_Air
#endplatform
Player.Visible = true
break
end switch
Player.XPos += Object.XPos
Player.YPos += Object.YPos
if Object.State > TUNNELPATH_4_INACTIVE
Player.Speed -= Player.XPos
FlipSign(Player.Speed)
end if
end if
end sub
sub ObjectPlayerInteraction
if Object.PropertyValue == 0
if Player.State != Player_State_Static
PlayerObjectCollision(C_TOUCH, -16, -16, 16, 16)
if CheckResult == true
Player.State = Player_State_Static
Player.ObjectInteraction = false
Player.Visible = false
if Player.BlinkTimer > 0
Player.InvincibleTimer = 0
Player.BlinkTimer = 0
end if
Object.State = TUNNELPATH_4_ACTIVE
Object.MoveSteps = -1
Object.Priority = PRIORITY_ACTIVE
PlaySfx(SFX_G_RELEASE, false)
end if
end if
end if
end sub
// ========================
// Editor Subs
// ========================
sub RSDKDraw
Object.InkEffect = 1
DrawSpriteFX(0,FX_INK,Object.XPos, Object.YPos)
if Editor.ShowGizmos == true
Editor.DrawingOverlay = true
CallFunction(EditorHelpers_FindTimePeriod)
switch CheckResult
case 0 // Present
case 3 // Bad Future
TempValue6 = 255
TempValue7 = 0
break
case 1 // Past
TempValue6 = 0
TempValue7 = 128
break
case 2 // Good Future
TempValue6 = 128
TempValue7 = 0
break
end switch
TempValue0 = 0
while TempValue0 < 2
TempValue1 = Object.XPos
TempValue2 = Object.YPos
TempValue3 = Object.XPos
TempValue4 = Object.YPos
TempValue5 = 0
switch TempValue0
case 0
TempValue1 += 0x88B00
TempValue3 += 0x88200
TempValue2 += 0x6200
TempValue4 += 0x1008200
TempValue5 = 1
break
case 1
TempValue1 += 0x88200
TempValue3 += 0x408B00
TempValue2 += 0x1008200
TempValue4 += 0x1008200
break
endswitch
DrawArrow(TempValue1, TempValue2, TempValue3, TempValue4, 255,
TempValue6, TempValue7)
// make the arrow thicker
if TempValue5 == 1
TempValue1 += 0x10000
TempValue3 += 0x10000
DrawArrow(TempValue1, TempValue2, TempValue3, TempValue4,
255, TempValue6, TempValue7)
else
TempValue2 -= 0x10000
TempValue4 -= 0x10000
DrawArrow(TempValue1, TempValue2, TempValue3, TempValue4,
255, TempValue6, TempValue7)
end if
TempValue0++
loop
Editor.DrawingOverlay = false
end if
end sub
sub RSDKLoad
LoadSpriteSheet("Players/Sonic1.gif")
SpriteFrame(-16, -16, 32, 32, 42, 118) // #0 - Sonic spin
SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
end sub