Path: blob/main/Scripts/R5/BossTop.txt
1319 views
//------------------Sonic CD Boss Top Script------------------//1//--------Scripted by Christian Whitehead 'The Taxman'--------//2//-------Unpacked By Rubberduckycooly's Script Unpacker-------//34// Aliases5#alias Object.Value0 : Object.Timer67// These Bounds Values:8// Before the Boss Fight starts, BoundsR is enforced here, the Boss Top Object9// While the Boss Fight is starting up, the stage's normal right bound is stored in OldBoundsR10// During the Boss Fight, new (not BoundsR) right bound is enforced in the Boss Platform Object11// After the Boss Right, right bounds is restored to normal based on what was stored to OldBoundsR previously12#alias Object.Value1 : Object.BoundsR13#alias Object.Value2 : Object.OldBoundsR1415// States16#alias 0 : BOSSTOP_IDLE17#alias 1 : BOSSTOP_MOVEBOUNDS18#alias 2 : BOSSTOP_BOSSFIGHT1920// Ink Effect21#alias 0 : INK_NONE222324sub ObjectMain2526switch Object.State27case BOSSTOP_MOVEBOUNDS28if Object.Timer < 5529Object.Timer++3031// Move the Bounds left by 2px32Object.BoundsR -= 0x2000033else34Object.State = BOSSTOP_BOSSFIGHT35end if36break3738end switch3940end sub414243sub ObjectPlayerInteraction4445if Object.State == BOSSTOP_IDLE4647// Get the Player's full X Position, including a small offset for their hitbox48TempValue0 = Player.CollisionRight49TempValue0 <<= 1650TempValue0 += Player.XPos5152// And then get this object's right border53TempValue1 = Object.BoundsR5455// See if the Player is past the Object's Right Bounds56if TempValue0 > TempValue157// If they are, then move the Player back in5859Player.XVelocity = 060Player.Speed = 06162Player.XPos = TempValue16364// CollisionRight is in screen-space, while XPos is in world-space, so shift it right by 1665TempValue0 = Player.CollisionRight66TempValue0 <<= 166768// And now adjust the Player's Position accordingly, to account for their right hitbox69Player.XPos -= TempValue070end if7172end if7374end sub757677sub ObjectDraw7879// Different draw routines based on the Object's current effect80if Object.InkEffect == INK_NONE8182// Draw the Boss Top83DrawSprite(0)8485TempValue0 = Object.XPos8687// 24 pixels to the left, draw the left Pole88TempValue0 -= 0x18000089DrawSpriteXY(1, TempValue0, Object.YPos)9091// 48 pixels to the right of that (24 pixels right absolute)92// draw the right Pole93TempValue0 += 0x30000094DrawSpriteXY(1, TempValue0, Object.YPos)9596else97// This Object's Ink Effect is set to INK_ALPHA when the boss is exploding98// (It's set from the Boss Platform Object, which controls most of the fight)99100// Draw the Boss's Top, and its flashing red overlay frame101DrawSprite(0)102DrawSpriteFX(2, FX_INK, Object.XPos, Object.YPos)103104// Draw the left Pole 24 pixels to the right, and its red overlay flashing frame ontop it as well105TempValue0 = Object.XPos106TempValue0 -= 0x180000107DrawSpriteXY(1, TempValue0, Object.YPos)108DrawSpriteFX(3, FX_INK, TempValue0, Object.YPos)109110// And don't forget the right pole either, 48 pixels to the right of that,111// which adds up to a 24 pixel + gain total, along with the flashing red overlay112// frame for this one too113TempValue0 += 0x300000114DrawSpriteXY(1, TempValue0, Object.YPos)115DrawSpriteFX(3, FX_INK, TempValue0, Object.YPos)116117end if118119end sub120121122sub ObjectStartup123LoadSpriteSheet("R5/Objects2.gif")124125// Base Boss Top Frame126SpriteFrame(-32, -24, 64, 48, 1, 1)127128// Pole Frame129SpriteFrame(-4, 24, 8, 88, 66, 1)130131// Flashing Boss Top Frame132SpriteFrame(-32, -24, 64, 48, 75, 1)133134// Flashing Pole Frame135SpriteFrame(-4, 24, 8, 88, 140, 1)136137end sub138139140// ========================141// Editor Subs142// ========================143144sub RSDKDraw145DrawSprite(0)146DrawSprite(1)147DrawSprite(2)148end sub149150151sub RSDKLoad152LoadSpriteSheet("R5/Objects2.gif")153SpriteFrame(-32, -24, 64, 48, 1, 1)154SpriteFrame( 20, 24, 8, 88, 66, 1)155SpriteFrame(-28, 24, 8, 88, 66, 1)156157SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")158end sub159160161