Path: blob/main/Scripts/FlowerPod/R6_FlowerPod.txt
1319 views
//---------------Sonic CD Flower Pod Script-------------------//1//--------Scripted by Christian Whitehead 'The Taxman'--------//2//-------Unpacked By Rubberduckycooly's Script Unpacker-------//34// Aliases5#alias Object.Value0 : Object.Timer67// PodSeed Aliases8#alias Object.Value1 : Object.ParentPod9#alias Object.Value2 : Object.XVelocity10#alias Object.Value3 : Object.YVelocity1112// States13#alias 0 : FLOWERPOD_IDLE14#alias 1 : FLOWERPOD_EXPLOSION15#alias 2 : FLOWERPOD_VANISH16#alias 3 : FLOWERPOD_TRIGGER_ACTFINISH17#alias 4 : FLOWERPOD_CONTROL_PLAYER1819// Control Modes20#alias -1 : CONTROLMODE_NONE2122// Ink Effects23#alias 2 : INK_ALPHA2425// Gravity26#alias 0 : GRAVITY_GROUND2728// Global SFX29#alias 22 : SFX_G_EXPLOSION3031// Priority32#alias 1 : PRIORITY_ACTIVE3334// Pod Seed Property Values35#alias 1 : TRIGGER_RESULTS363738sub ObjectMain39switch Object.State40case FLOWERPOD_IDLE41TempValue0 = Object.YPos42TempValue0 += 0x40005A43if Player.YPos < TempValue044Stage.NewXBoundary1 = Object.XPos45Stage.NewXBoundary1 >>= 1646Stage.NewXBoundary1 -= Screen.CenterX4748Stage.NewXBoundary2 = Object.XPos49Stage.NewXBoundary2 >>= 1650Stage.NewXBoundary2 += Screen.CenterX51end if5253if Object.Timer < 6054Object.Frame = 155else56TempValue0 = Object.Timer57TempValue0 -= 6058TempValue0 >>= 159switch TempValue060case 061Object.Frame = 262break63case 164case 265Object.Frame = 166break67case 368Object.Frame = 269break70case 471case 572Object.Frame = 173break74case 675Object.Frame = 276break77end switch78end if7980Object.Timer++81if Object.Timer == 7482Object.Timer = 083end if84break8586case FLOWERPOD_EXPLOSION87if Object.Timer < 12088Object.Timer++8990TempValue0 = Object.Timer91TempValue0 &= 392if TempValue0 == 393Rand(TempValue0, 64)94TempValue0 -= 3295TempValue0 <<= 1696TempValue0 += Object.XPos9798Rand(TempValue1, 40)99TempValue1 -= 40100TempValue1 <<= 16101TempValue1 += Object.YPos102103CreateTempObject(TypeName[Explosion], 0, TempValue0, TempValue1)104PlaySfx(SFX_G_EXPLOSION, false)105end if106else107Object.State = FLOWERPOD_VANISH108Object.Timer = 256109Object.InkEffect = INK_ALPHA110Object.Alpha = 255111112113// Create all the Seeds that burst out of the Pod114115// Starting point is 3 pixels left and 24 pixels up from the Flower Pod's position116TempValue0 = Object.XPos117TempValue0 -= 0x30000118TempValue1 = Object.YPos119TempValue1 -= 0x180000120121// Create the leading seed, note its Property Value of 1 to signify that it should start level results upon landing122CreateTempObject(TypeName[Pod Seed], TRIGGER_RESULTS, TempValue0, TempValue1)123Object[TempObjectPos].XVelocity = -0x20000124Object[TempObjectPos].YVelocity = -0x60000125Object[TempObjectPos].ParentPod = Object.EntityNo126127TempValue0 += 0x10000128CreateTempObject(TypeName[Pod Seed], 0, TempValue0, TempValue1)129Object[TempObjectPos].XVelocity = -0x15554130Object[TempObjectPos].YVelocity = -0x60000131132TempValue0 += 0x10000133CreateTempObject(TypeName[Pod Seed], 0, TempValue0, TempValue1)134Object[TempObjectPos].XVelocity = -0xAAAA135Object[TempObjectPos].YVelocity = -0x60000136137TempValue0 += 0x10000138CreateTempObject(TypeName[Pod Seed], 0, TempValue0, TempValue1)139Object[TempObjectPos].XVelocity = 0140Object[TempObjectPos].YVelocity = -0x60000141142TempValue0 += 0x10000143CreateTempObject(TypeName[Pod Seed], 0, TempValue0, TempValue1)144Object[TempObjectPos].XVelocity = 0xAAAA145Object[TempObjectPos].YVelocity = -0x60000146147TempValue0 += 0x10000148CreateTempObject(TypeName[Pod Seed], 0, TempValue0, TempValue1)149Object[TempObjectPos].XVelocity = 0x15554150Object[TempObjectPos].YVelocity = -0x60000151152TempValue0 += 0x10000153CreateTempObject(TypeName[Pod Seed], 0, TempValue0, TempValue1)154Object[TempObjectPos].XVelocity = 0x20000155Object[TempObjectPos].YVelocity = -0x60000156end if157break158159case FLOWERPOD_VANISH160if Object.Timer > 0161Object.Timer -= 16162Object.Alpha = Object.Timer163end if164break165166case FLOWERPOD_TRIGGER_ACTFINISH167if Player.ControlMode == CONTROLMODE_NONE168Player.Left = false169Player.Right = true170Player.Up = false171Player.Down = false172Player.JumpHold = false173end if174175TempValue0 = Object.XPos176TempValue0 += 0xA00000177if Player.XPos > TempValue0178PlayMusic(1)179Object.State = FLOWERPOD_CONTROL_PLAYER180Object[30].Type = TypeName[ActFinish]181Object[30].DrawOrder = 6182Object[30].Priority = PRIORITY_ACTIVE183end if184break185186case FLOWERPOD_CONTROL_PLAYER187if Player.ControlMode == CONTROLMODE_NONE188Player.Right = true189end if190break191end switch192end sub193194195sub ObjectPlayerInteraction196if Object.State == FLOWERPOD_IDLE197// if Player.Animation == ANI_JUMPING // Standalone/Preplus check198199CheckResult = false200if Player.Animation == ANI_JUMPING201CheckResult = true202end if203#platform: Use_Origins204if Stage.PlayerListPos == PLAYER_KNUCKLES205if Player.Animation == ANI_GLIDING206CheckResult = true207end if208if Player.Animation == ANI_GLIDING_STOP209CheckResult = true210end if211end if212if Stage.PlayerListPos == PLAYER_AMY213if Player.Animation == ANI_HAMMER_DASH214CheckResult = true215end if216if Player.Animation == ANI_HAMMER_JUMP217CheckResult = true218end if219end if220#endplatform221if CheckResult == true222#platform: Use_Origins223PlayerObjectCollision(C_ENEMY, -28, -46, 28, 6)224#endplatform225#platform: Use_Standalone226PlayerObjectCollision(C_TOUCH, -28, -46, 28, 6)227#endplatform228if CheckResult == true229Stage.TimeEnabled = false230231Object.State = FLOWERPOD_EXPLOSION232Object.Frame = 3233Object.Timer = 0234235Player.YVelocity >>= 1236FlipSign(Player.YVelocity)237238#platform: Use_Haptics239HapticEffect(55, 0, 0, 0)240#endplatform241242#platform: Use_Origins243// Tell HE2 that the boss fight ended244game.callbackParam0 = true245EngineCallback(NOTIFY_BOSS_END)246#endplatform247end if248end if249end if250TempValue0 = Screen.CenterX251TempValue0 += 40252TempValue0 <<= 16253254TempValue1 = Object.XPos255TempValue1 += TempValue0256257if Player.XPos > TempValue1258Player.XPos = TempValue1259Player.Speed = 0260Player.XVelocity = 0261if Player.Gravity == GRAVITY_GROUND262Player.YVelocity = 0263end if264end if265end sub266267268sub ObjectDraw269if Object.State < FLOWERPOD_VANISH270DrawSprite(0)271DrawSprite(Object.Frame)272else273DrawSpriteFX(0, FX_INK, Object.XPos, Object.YPos)274DrawSpriteFX(Object.Frame, FX_INK, Object.XPos, Object.YPos)275end if276end sub277278279sub ObjectStartup280LoadSpriteSheet("R6/Objects2.gif")281282SpriteFrame(-32, 6, 64, 42, 1, 55) // #0 - FlowerPod Stem283SpriteFrame(-32, -48, 64, 54, 1, 1) // #1 - FlowerPod Bulb284SpriteFrame(-32, -48, 64, 54, 1, 98) // #2 - FlowerPod Bulb Flash285SpriteFrame(-32, -10, 64, 16, 1, 153) // #3 - FlowerPod Bulb Destroyed286287ArrayPos0 = 32288while ArrayPos0 < 1056289if Object[ArrayPos0].Type == TypeName[Flower Pod]290TempValue0 = Screen.CenterX291TempValue0 -= 160292TempValue0 <<= 16293Object[ArrayPos0].XPos -= TempValue0294end if295ArrayPos0++296loop297end sub298299300// ========================301// Editor Subs302// ========================303304sub RSDKDraw305DrawSprite(0)306DrawSprite(1)307end sub308309310sub RSDKLoad311LoadSpriteSheet("R6/Objects2.gif")312313SpriteFrame(-32, 6, 64, 42, 1, 55) // #0 - FlowerPod Stem314SpriteFrame(-32, -48, 64, 54, 1, 1) // #1 - FlowerPod Bulb315316SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")317end sub318319320