Path: blob/main/Scripts/Special/UFOPowerUp.txt
1319 views
//---------------Sonic CD UFO Power Up Script-----------------//1//--------Scripted by Christian Whitehead 'The Taxman'--------//2//-------Unpacked By Rubberduckycooly's Script Unpacker-------//34// Aliases5#alias Object.Value0 : Object.ExplosionDir6#alias Object.Value1 : Object.ExplosionXVel7#alias Object.Value2 : Object.ExplosionYVel8#alias Object.Value3 : Object.Timer9#alias Object.Value4 : Object.YVelocity10#alias Object.Value5 : Object.ScreenDepth // Not used in this script, but set by the parent UFO Object upon spawning11#alias Object.Value6 : Object.ExplosionTimer12#alias Object.Value7 : Object.StartResults1314// Player aliases15#alias Object.State : SSSonic.State1617#alias 9 : SSSONIC_CAMERAPAN1819// Stage Finish Aliases20#alias 8 : STAGEFINISH_LOADTIMEATTACK21#alias 9 : STAGEFINISH_LOADCREDITS2223// SFX aliases24#alias 22 : SFX_G_EXPLOSION2526// Game Mode Aliases27#alias 2 : MODE_TIMEATTACK282930sub ObjectDraw31// If the Object isn't falling at a rate of 4px downwards per frame yet, then update movements32if Object.YVelocity < 0x400003334// Draw the Power Up icon35DrawSpriteScreenXY(Object.PropertyValue, Object.iXPos, Object.iYPos)3637// Apply an eighth pixel's worth of gravity per frame38Object.YVelocity += 0x20003940// And then update the Power Up's position itself41Object.YPos += Object.YVelocity42end if4344// Create explosions as needed45Object.ExplosionTimer++46if Object.ExplosionTimer == 647Object.ExplosionTimer = 048PlaySfx(SFX_G_EXPLOSION, false)4950// Randomise the explosion offset a tad bit51Rand(TempValue0, 48)52TempValue0 -= 2453TempValue0 += Screen.XOffset54TempValue0 <<= 1655TempValue0 += Object.ExplosionXVel5657Rand(TempValue1, 48)58TempValue1 -= 2459TempValue1 += Screen.YOffset60TempValue1 <<= 1661TempValue1 += Object.ExplosionYVel6263CreateTempObject(TypeName[Smoke Puff], 0, TempValue0, TempValue1)6465Object[TempObjectPos].DrawOrder = 466end if6768// This value is randomised by the parent UFO object already, this Object doesn't set it itself69if Object.ExplosionDir > 5070// Moving to the bottom right corner of the screen7172Object.ExplosionXVel += 0x2000073else74// Moving to the bottom left corner of the screen7576Object.ExplosionXVel -= 0x2000077end if7879// Make the explosions gravitate to the bottom corner of the screen, at a rate of 0.75 pixels per frame80Object.ExplosionYVel += 0xC0008182Object.Timer++83if Object.Timer == 16084if Object.StartResults == true85// If this object was the spawned by the last UFO, then end the stage86// -> StartResults is set by the parent UFO when spawning this Power Up8788if Options.GameMode < MODE_TIMEATTACK89if Stage.ActNo < 890// If in a normal Special Stage, then hand the rest of the ending sequence to Sonic9192SSSonic[2].State = SSSONIC_CAMERAPAN93else94// If in the hidden Robotnik Special Stage, then go ahead and load the credits9596Object[30].Type = TypeName[Stage Finish]97Object[30].State = STAGEFINISH_LOADCREDITS98Object[30].DrawOrder = 799end if100else101// If in time attack, then go ahead and fade out to the TA Menu scene102103Object[30].Type = TypeName[Stage Finish]104Object[30].State = STAGEFINISH_LOADTIMEATTACK105Object[30].DrawOrder = 0106end if107end if108109Object.Type = TypeName[Blank Object]110end if111112end sub113114115sub ObjectStartup116117LoadSpriteSheet("Special/Objects.gif")118119// 0 - Ring Icon120SpriteFrame(-8, -8, 16, 16, 1, 67)121122// 1 - Speed Shoes Icon123SpriteFrame(-8, -8, 16, 16, 18, 67)124125// 2 - Clock Icon126SpriteFrame(-8, -8, 16, 16, 35, 67)127128end sub129130131// ========================132// Editor Subs133// ========================134135sub RSDKDraw136DrawSprite(0)137end sub138139140sub RSDKLoad141LoadSpriteSheet("Special/Objects.gif")142SpriteFrame(-8, -8, 16, 16, 1, 67)143144// Although used by the object, it shouldn't be set by the editor145SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")146end sub147148149