Path: blob/main/Scripts/R3/ScoreChute.txt
1319 views
//----------------Sonic CD Score Chute Script-----------------//1//--------Scripted by Christian Whitehead 'The Taxman'--------//2//-------Unpacked By Rubberduckycooly's Script Unpacker-------//34// Aliases5#alias Object.Value0 : Object.Timer6#alias Object.Value1 : Object.ScoreBonus78// Player Aliases9#alias Player.Value4 : Player.InvincibleTimer10#alias Player.Value5 : Player.BlinkTimer1112// States13#alias 0 : SCORECHUTE_IDLE14#alias 1 : SCORECHUTE_CATCH_PLAYER15#alias 2 : SCORECHUTE_INSERT_116#alias 3 : SCORECHUTE_INSERT_217#alias 4 : SCORECHUTE_GIVE_POINTS18#alias 5 : SCORECHUTE_PULL_PLAYER19#alias 6 : SCORECHUTE_EJECT_PLAYER20#alias 7 : SCORECHUTE_COOLDOWN2122// Players23#alias 0 : PLAYER_SONIC_A2425// Stage SFX26#alias 2 : SFX_S_SCORECHUTE27#alias 3 : SFX_S_CHUTEEXIT2829// Priority30#alias 0 : PRIORITY_BOUNDS31#alias 1 : PRIORITY_ACTIVE323334sub ObjectMain35switch Object.State36case SCORECHUTE_CATCH_PLAYER37if Object.Timer < 838Object.Timer++39Player.XPos = Object.XPos40Player.YPos = Object.YPos41Player.YPos -= 0x8000042Player.YVelocity = 043Player.XVelocity = 044Player.Speed = 045else46Object.State = SCORECHUTE_INSERT_147Object.Timer = 048Player.YVelocity = 049Player.XVelocity = 050Player.Visible = false51if Player.BlinkTimer > 052Player.InvincibleTimer = 053Player.BlinkTimer = 054end if55Player.State = Player_State_Static56end if57break5859case SCORECHUTE_INSERT_160if Object.Timer < 861Object.Timer++62Player.XPos = Object.XPos63Player.YPos = Object.YPos64Player.YPos -= 0x8000065else66Object.State = SCORECHUTE_INSERT_267Object.Timer = 068end if69break7071case SCORECHUTE_INSERT_272if Object.Timer < 473Object.Timer++74else75Object.State = SCORECHUTE_GIVE_POINTS76Object.Timer = 077end if78// in case of time over79if Player.State == Player_State_Death80Object.State = SCORECHUTE_COOLDOWN81Object.Timer = 082Player.Visible = true83end if84break8586case SCORECHUTE_GIVE_POINTS87if Object.ScoreBonus < 488if Object.Timer == 3289CreateTempObject(TypeName[Object Score], 0, Object.XPos, Object.YPos)90Player.Score += 10091end if92end if93if Object.ScoreBonus < 394if Object.Timer == 6495CreateTempObject(TypeName[Object Score], 0, Object.XPos, Object.YPos)96Player.Score += 10097end if98end if99if Object.Timer < 80100Object.Timer++101else102Object.State = SCORECHUTE_PULL_PLAYER103Object.Timer = 0104end if105// in case of time over106if Player.State == Player_State_Death107Object.State = SCORECHUTE_COOLDOWN108Object.Timer = 0109Player.Visible = true110end if111break112113case SCORECHUTE_PULL_PLAYER114if Object.Timer < 4115Object.Timer++116else117Object.State = SCORECHUTE_EJECT_PLAYER118Object.Timer = 0119end if120if Player.State == Player_State_Death // in case of time over121Object.State = SCORECHUTE_COOLDOWN122Object.Timer = 0123Player.Visible = true124end if125break126127case SCORECHUTE_EJECT_PLAYER128if Object.Timer < 8129Object.Timer++130else131Object.State = SCORECHUTE_COOLDOWN132Object.Timer = 0133134#platform: Use_Origins135Player.State = Player_State_Air_NoDropDash136#endplatform137138#platform: Use_Standalone139Player.State = Player_State_Air140#endplatform141142Player.Visible = true143Player.Animation = ANI_JUMPING144145Player.ObjectInteraction = true146147Player.YVelocity = -0x74000148Player.Timer = 0149PlayStageSfx(SFX_S_CHUTEEXIT, false)150end if151break152153case SCORECHUTE_COOLDOWN154if Object.Timer < 120155Object.Timer++156else157Object.State = SCORECHUTE_IDLE158Object.Timer = 0159Object.ScoreBonus++160end if161break162163end switch164165if Object.OutOfBounds == true166Object.ScoreBonus = 0167Object.Priority = PRIORITY_BOUNDS168end if169end sub170171172sub ObjectPlayerInteraction173if Object.State == SCORECHUTE_IDLE174if Player.YVelocity >= 0175PlayerObjectCollision(C_TOUCH, -16, -8, 16, 16)176if CheckResult == true177Object.State = SCORECHUTE_CATCH_PLAYER178Object.Priority = PRIORITY_ACTIVE179180Player.Animation = ANI_JUMPING181Player.ObjectInteraction = false182183PlayStageSfx(SFX_S_SCORECHUTE, false)184185#platform: Use_Haptics186HapticEffect(55, 0, 0, 0)187#endplatform188189end if190end if191end if192end sub193194195sub ObjectDraw196switch Object.State197case SCORECHUTE_CATCH_PLAYER198DrawSprite(0)199break200201case SCORECHUTE_INSERT_1202DrawSprite(0)203DrawSprite(1)204break205206case SCORECHUTE_INSERT_2207DrawSprite(0)208DrawSprite(2)209break210211case SCORECHUTE_GIVE_POINTS212TempValue0 = Object.Timer213TempValue0 &= 7214TempValue0 >>= 2215if TempValue0 > 0216DrawSprite(0)217end if218break219220case SCORECHUTE_PULL_PLAYER221DrawSprite(0)222DrawSprite(2)223break224225case SCORECHUTE_EJECT_PLAYER226DrawSprite(0)227DrawSprite(1)228break229230end switch231end sub232233234sub ObjectStartup235#platform: Use_Standalone236LoadSpriteSheet("R3/Objects.gif")237SpriteFrame(-24, -8, 48, 16, 117, 233) // #0 - Score Chute Active238239if Stage.PlayerListPos == PLAYER_SONIC_A240SpriteFrame(-16, -24, 32, 16, 2, 240) // #1 - Jump Insert Frame 0241SpriteFrame(-8, -16, 16, 8, 35, 241) // #2 - Jump Insert Frame 1242else243SpriteFrame(-12, -20, 24, 12, 228, 244) // #1 - Jump Insert Frame 0244SpriteFrame(-8, -16, 16, 8, 211, 247) // #2 - Jump Insert Frame 1245end if246#endplatform247248#platform: Use_Origins249if Stage.PlayerListPos == PLAYER_SONIC250LoadSpriteSheet("R3/Objects.gif")251SpriteFrame(-24, -8, 48, 16, 117, 233) // #0 - Score Chute Active252SpriteFrame(-16, -24, 32, 16, 2, 240) // #1 - Jump Insert Frame 0253SpriteFrame(-8, -16, 16, 8, 35, 241) // #2 - Jump Insert Frame 1254end if255256if Stage.PlayerListPos == PLAYER_TAILS257LoadSpriteSheet("R3/Objects.gif")258SpriteFrame(-24, -8, 48, 16, 117, 233) // #0 - Score Chute Active259SpriteFrame(-12, -20, 24, 12, 228, 244) // #1 - Jump Insert Frame 0260SpriteFrame(-8, -16, 16, 8, 211, 247) // #2 - Jump Insert Frame 1261end if262263if Stage.PlayerListPos == PLAYER_KNUCKLES264LoadSpriteSheet("R3/Objects3.gif")265SpriteFrame(-24, -8, 48, 16, 99, 133) // #0 - Score Chute Active266SpriteFrame(-16, -24, 32, 16, 66, 150) // #1 - Jump Insert Frame 0267SpriteFrame(-8, -16, 16, 8, 116, 150) // #2 - Jump Insert Frame 1268end if269270if Stage.PlayerListPos == PLAYER_AMY271LoadSpriteSheet("R3/Objects3.gif")272SpriteFrame(-24, -8, 48, 16, 99, 133) // #0 - Score Chute Active273SpriteFrame(-16, -24, 32, 16, 66, 133) // #1 - Jump Insert Frame 0274SpriteFrame(-8, -16, 16, 8, 99, 150) // #2 - Jump Insert Frame 1275end if276#endplatform277278// Used to be below LoadSpriteSheet, moved here for consistency279ArrayPos0 = 32280while ArrayPos0 < 1056281if Object[ArrayPos0].Type == TypeName[Score Chute]282Object[ArrayPos0].DrawOrder = 4283end if284ArrayPos0++285loop286end sub287288289// ========================290// Editor Subs291// ========================292293sub RSDKDraw294DrawSprite(0)295end sub296297298sub RSDKLoad299LoadSpriteSheet("R3/Objects.gif")300301SpriteFrame(-24, -8, 48, 16, 117, 233) // #0 - Score Chute Active302303SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")304end sub305306307