Path: blob/main/Scripts/Mission/Sasuri2.txt
1319 views
//------------------Sonic CD Sasuri 2 Script------------------//1//--------Scripted by Christian Whitehead 'The Taxman'--------//2//-------Unpacked By Rubberduckycooly's Script Unpacker-------//3//-------------Used on Mission "M093 - Fast Foes"-------------//45// Aliases6#alias Object.Value0 : Object.MoveTimer7#alias Object.Value1 : Object.CannonTimer8#alias Object.Value2 : Object.LeftPlatformBound9#alias Object.Value3 : Object.RightPlatformBound1011// Sasuri Bullet (SBullet) Aliases12#alias Object.Value1 : Object.XVelocity1314// States15#alias 0 : SASURI2_SETBOUNDS16#alias 1 : SASURI2_CRAWLLEFT17#alias 2 : SASURI2_CRAWLRIGHT18#alias 3 : SASURI2_SPOTPLAYER19#alias 4 : SASURI2_SHOOT20#alias 5 : SASURI2_RETRACTCANNON2122// Stage SFX23#alias 2 : SFX_S_SHOT242526sub ObjectMain27Object.Frame++28Object.Frame %= 6029switch Object.State30case SASURI2_SETBOUNDS31// Object[+1] is whatever platform Sasuri is on top32Object.YPos = Object[+1].YPos33Object.iYPos -= 283435Object.RightPlatformBound = 3236Object.RightPlatformBound <<= 163738Object.LeftPlatformBound = 039Object.LeftPlatformBound -= Object.RightPlatformBound4041Object.RightPlatformBound += Object[+1].XPos42Object.LeftPlatformBound += Object[+1].XPos4344Object.State = SASURI2_CRAWLLEFT45break4647case SASURI2_CRAWLLEFT48// Move the Sasuri left by one pixel49Object.XPos -= 0x100005051// Increment its movement timer, and see if it's time to turn around now52Object.MoveTimer--53if Object.MoveTimer <= -8054Object.State = SASURI2_CRAWLRIGHT55Object.Direction=FACING_LEFT56end if5758if Object.XPos < Object.LeftPlatformBound59Object.State = SASURI2_CRAWLRIGHT60Object.MoveTimer = 061Object.Direction=FACING_LEFT62end if63break6465case SASURI2_CRAWLRIGHT66Object.XPos += 0x100006768// As with above, do timer stuff and see if the Sasuri should turn around now69Object.MoveTimer++70if Object.MoveTimer >= 8071Object.State = SASURI2_CRAWLLEFT72Object.Direction = FACING_RIGHT73end if7475if Object.XPos > Object.RightPlatformBound76Object.State = SASURI2_CRAWLLEFT77Object.MoveTimer = 078Object.Direction=FACING_RIGHT79end if80break8182case SASURI2_SPOTPLAYER83// This state's set in ObjectPlayerInteraction if the Player is within shooting range8485if Object.CannonTimer < 3086Object.CannonTimer++87else88Object.State = SASURI2_SHOOT89Object.CannonTimer = 090end if91break9293case SASURI2_SHOOT94if Object.CannonTimer < 4095if Object.CannonTimer == 1096PlayStageSfx(SFX_S_SHOT, false)9798// Create the Bullet that the Sasuri shot99CreateTempObject(TypeName[Sasuri Bullet], 0, Object.XPos, Object.YPos)100101// Move the Bullet 24 pixels up, to match where the Sasuri's cannon is drawn102Object[TempObjectPos].YPos -= 0x180000103104// Move it 24 pixels in the Sasuri's direction, as well as giving it a velocity of 3px per frame in that very same direction too105if Object.Direction == FACING_RIGHT106Object[TempObjectPos].XPos -= 0x70000107Object[TempObjectPos].XVelocity = -0x30000108else109Object[TempObjectPos].XPos += 0x70000110Object[TempObjectPos].XVelocity = 0x30000111end if112113// Move the Sasuri up a Draw Order in order to make it drawn on top of the shot Bullet114Object.DrawOrder = 4115end if116117Object.CannonTimer++118else119// Pull the cannon back in120Object.State = SASURI2_RETRACTCANNON121Object.CannonTimer = 0122123// Move the Sasuri back to its original Draw Order, as at this point124// the Bullet's definitely beyond the Sasuri now125Object.DrawOrder = 3126end if127break128129case SASURI2_RETRACTCANNON130if Object.CannonTimer < 30131Object.CannonTimer++132else133134// ...what?135// Why make it shoot again? The State's set proper in a couple of lines after anyway...136Object.State = SASURI2_SHOOT137138if Object.Direction == FACING_RIGHT139Object.State = SASURI2_CRAWLLEFT140else141Object.State = SASURI2_CRAWLRIGHT142end if143end if144break145end switch146147CallFunction(StageSetup_CheckGoodFuture)148end sub149150151sub ObjectPlayerInteraction152153PlayerObjectCollision(C_ENEMY, -22, -14, 22, 14)154if CheckResult == true155CallFunction(Player_BadnikBreak)156end if157158switch Object.State159case SASURI2_CRAWLLEFT160case SASURI2_CRAWLRIGHT161// If in a movement state, then see if the Sasuri162if Object.CannonTimer == 0163PlayerObjectCollision(C_TOUCH, -64, -24, 64, 24)164if CheckResult == true165Object.State = SASURI2_SPOTPLAYER166167if Player.XPos < Object.XPos168Object.Direction = FACING_RIGHT169else170Object.Direction = FACING_LEFT171end if172end if173else174Object.CannonTimer = 0175end if176break177178end switch179end sub180181182sub ObjectDraw183if Object.Frame < 30184// In this order, draw the:185// - back paw186// - main body187// - front paw188189DrawSpriteFX(2, FX_FLIP, Object.XPos, Object.YPos)190DrawSpriteFX(0, FX_FLIP, Object.XPos, Object.YPos)191DrawSpriteFX(3, FX_FLIP, Object.XPos, Object.YPos)192else193// These are the same order as detailed above, just with different frames for the paws194195DrawSpriteFX(4, FX_FLIP, Object.XPos, Object.YPos)196DrawSpriteFX(0, FX_FLIP, Object.XPos, Object.YPos)197DrawSpriteFX(5, FX_FLIP, Object.XPos, Object.YPos)198end if199200switch Object.State201case SASURI2_CRAWLLEFT202case SASURI2_CRAWLRIGHT203case SASURI2_SPOTPLAYER204case SASURI2_RETRACTCANNON205// Draw the pulled back cannon frame206DrawSpriteFX(10, FX_FLIP, Object.XPos, Object.YPos)207break208209case SASURI2_SHOOT210// The Sasuri's shooting, so draw the extended cannon frame211DrawSpriteFX(11, FX_FLIP, Object.XPos, Object.YPos)212break213214end switch215end sub216217218sub ObjectStartup219LoadSpriteSheet("R5/Objects.gif")220221// Sasuri Frames222223// Good Main Sasuri Frame224SpriteFrame(-24, -16, 48, 32, 174, 141)225226// Bad Main Sasuri Frame227SpriteFrame(-24, -16, 48, 32, 174, 174)228229// Good Sasuri Paw Frames230SpriteFrame(-32, -4, 32, 16, 100, 110)231SpriteFrame(-21, -3, 32, 16, 100, 110)232SpriteFrame(-28, -4, 32, 16, 100, 110)233SpriteFrame(-25, -3, 32, 16, 100, 110)234235// Bad Sasuri Paw Frames236SpriteFrame(-32, -4, 32, 16, 100, 127)237SpriteFrame(-21, -3, 32, 16, 100, 127)238SpriteFrame(-28, -4, 32, 16, 100, 127)239SpriteFrame(-25, -3, 32, 16, 100, 127)240241// Good Sasuri Cannon Frames242SpriteFrame(-9, -24, 24, 16, 100, 93)243SpriteFrame(-5, -29, 24, 16, 100, 93)244245// Bad Sasuri Cannon Frames246SpriteFrame(-1, -24, 16, 16, 133, 110)247SpriteFrame(3, -29, 16, 16, 133, 110)248249end sub250251252// ========================253// Editor Subs254// ========================255256sub RSDKDraw257DrawSprite(2)258DrawSprite(0)259DrawSprite(3)260DrawSprite(6)261end sub262263264sub RSDKLoad265LoadSpriteSheet("R5/Objects.gif")266267SpriteFrame(-24, -16, 48, 32, 174, 141)268SpriteFrame(-24, -16, 48, 32, 174, 174)269270SpriteFrame(-32, -4, 32, 16, 100, 110)271SpriteFrame(-21, -3, 32, 16, 100, 110)272273SpriteFrame(-32, -4, 32, 16, 100, 127)274SpriteFrame(-21, -3, 32, 16, 100, 127)275276SpriteFrame(-9, -24, 24, 16, 100, 93)277SpriteFrame(-1, -24, 16, 16, 133, 110)278279SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")280end sub281282