Path: blob/main/Scripts/R5/BossBomb.txt
1319 views
//-----------------Sonic CD Boss Bomb 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.XVelocity7#alias Object.Value2 : Object.YVelocity8#alias Object.Value3 : Object.Gravity910// Player Aliases11#alias Object[0].Value0 : Player.Rings1213// States14#alias 0 : BOSSBOMB_CARRIED15#alias 1 : BOSSBOMB_ACTIVE1617// Collision Sides18#alias 0 : CSIDE_FLOOR1920// Global SFX21#alias 22 : SFX_G_EXPLOSION2223// Stage SFX24#alias 4 : SFX_S_IMPACT12526// Property Values27#alias 0 : BOMB28#alias 1 : BOMB_FRAGMENT293031sub ObjectMain3233if Object.PropertyValue == BOMB34// Object is a Bomb3536if Object.State == BOSSBOMB_ACTIVE3738// Make the Bomb fall at a rate of 2px per frame39Object.YPos += 0x200004041// See if the Bomb's touched the ground yet42ObjectTileCollision(CSIDE_FLOOR, 0, 10, 0)4344if CheckResult == true45if Object.Timer < 446// There's a short delay between hitting the ground and actually exploding47Object.Timer++48else49PlayStageSfx(SFX_S_IMPACT1, false)5051// Now that the Bomb's supposed to explode, create all of the Bomb Fragments5253// Create the first Bomb Fragment, with starting values of:54// - Offset of 4px left, 4px up55// - XVelocity of 0.625px left per frame56// - YVelocity of 4px up per frame57// - Gravity acceleration of 0.1875px58CreateTempObject(TypeName[Boss Bomb], BOMB_FRAGMENT, Object.XPos, Object.YPos)59Object[TempObjectPos].XPos -= 0x4000060Object[TempObjectPos].YPos -= 0x4000061Object[TempObjectPos].XVelocity = -0xA00062Object[TempObjectPos].YVelocity = -0x4000063Object[TempObjectPos].Gravity = 0x30006465// And then the next Fragment, with initial values of:66// - Offset of 4px right, 4px up67// - XVelocity of 0.625px right per frame68// - YVelocity of 4px up per frame69// - Gravity acceleration of 0.1875px70CreateTempObject(TypeName[Boss Bomb], BOMB_FRAGMENT, Object.XPos, Object.YPos)71Object[TempObjectPos].XPos += 0x4000072Object[TempObjectPos].YPos -= 0x4000073Object[TempObjectPos].XVelocity = 0xA00074Object[TempObjectPos].YVelocity = -0x4000075Object[TempObjectPos].Gravity = 0x30007677// And another!78// This one's initial values are:79// - Offset of 4px left, 4px down80// - XVelocity of 1.25px left per frame81// - YVelocity of 2.25px up per frame82// - Gravity acceleration of 0.09375px83CreateTempObject(TypeName[Boss Bomb], BOMB_FRAGMENT, Object.XPos, Object.YPos)84Object[TempObjectPos].XPos -= 0x4000085Object[TempObjectPos].YPos += 0x4000086Object[TempObjectPos].XVelocity = -0x1400087Object[TempObjectPos].YVelocity = -0x2400088Object[TempObjectPos].Gravity = 0x18008990// Last but certainly not least, give this final Fragment91// some pretty good starting values of:92// - Offset of 4px right, 4px down93// - XVelocity of 1.25px left per frame94// - YVelocity of 2.25px up per frame95// - Gravity acceleration of 0.09375px96CreateTempObject(TypeName[Boss Bomb], BOMB_FRAGMENT, Object.XPos, Object.YPos)97Object[TempObjectPos].XPos += 0x4000098Object[TempObjectPos].YPos += 0x4000099Object[TempObjectPos].XVelocity = 0x14000100Object[TempObjectPos].YVelocity = -0x24000101Object[TempObjectPos].Gravity = 0x1800102103// This main Boss Bomb Object doesn't actually explode and unload -104// instead, upon landing on the ground and exploding, it resets itself105// and the same Object is used for future explosions106107Object.State = BOSSBOMB_CARRIED108Object.Timer = 0109110// Return back to the Boss Top's Position111Object.XPos = Object[+2].XPos112Object.YPos = Object[+2].YPos113114#platform: Use_Haptics115HapticEffect(77, 0, 0, 0)116#endplatform117end if118end if119end if120else121// Bomb Fragment122123// Update the Fragment's horizontal movements124Object.XPos += Object.XVelocity125126// Apply Gravity to the Fragment127// -> Each piece has different Gravity values, which is why128// this is an Object Value and not a constant value129Object.YVelocity += Object.Gravity130131// And then, actually apply Y movement132Object.YPos += Object.YVelocity133134if Object.OutOfBounds == true135// If no longer needed, unload the Object136Object.Type = TypeName[Blank Object]137end if138139end if140141end sub142143144sub ObjectPlayerInteraction145146if Object.State == BOSSBOMB_ACTIVE147148// Check Interaction with the Player149PlayerObjectCollision(C_TOUCH, -10, -10, 10, 10)150151if CheckResult == true152153// Explode if the Player has zero rings... except I think this is bugged?154// This check always returns true, regardless of how many rings the Player has,155// so the bomb always disappears...156if Player.Rings == 0157Object.State = BOSSBOMB_CARRIED158159// Explode, creating the Explosion as a Temp Object rather than in this Object160// slot because the Bomb should remain161CreateTempObject(TypeName[Explosion], 0, Object.XPos, Object.YPos)162163// Move the Bomb back to the Boss Top's Position164Object.XPos = Object[+2].XPos165Object.YPos = Object[+2].YPos166167PlaySfx(SFX_G_EXPLOSION, false)168end if169170// And now, only after checking the Player's rings, see if we should hurt the Player171CallFunction(Player_Hit)172173// If the Player was indeed hurt...174if Player.State == Player_State_GotHit175// ...then reset the Boss Platform's Speed Value176Object[+5].Value3 = 0xC000177end if178179end if180else181if Object.PropertyValue == 1182// Bomb Fragment183184PlayerObjectCollision(C_TOUCH, -7, -7, 7, 7)185186if CheckResult == true187188// Similarly to above, I believe this check against the Player's Rings189// may actually be a bit bugged...190if Player.Rings == 0191Object.State = BOSSBOMB_CARRIED192CreateTempObject(TypeName[Explosion], 0, Object.XPos, Object.YPos)193Object.Type = TypeName[Blank Object]194PlaySfx(SFX_G_EXPLOSION, false)195end if196197CallFunction(Player_Hit)198end if199end if200end if201202end sub203204205sub ObjectDraw206DrawSprite(Object.PropertyValue)207end sub208209210sub ObjectStartup211LoadSpriteSheet("R5/Objects2.gif")212213// Bomb Frame214SpriteFrame(-12, -12, 24, 24, 75, 113)215216// Bomb Fragment Frame217SpriteFrame(-8, -8, 16, 16, 131, 138)218219end sub220221222// ========================223// Editor Subs224// ========================225226sub RSDKDraw227DrawSprite(0)228end sub229230231sub RSDKLoad232LoadSpriteSheet("R5/Objects2.gif")233SpriteFrame(-12, -12, 24, 24, 75, 113)234235// Although used by the Object, only the normal Boss Bomb Object should ever be placed in a scene236SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")237end sub238239240