Path: blob/main/Scripts/Mission/KumoKumo2.txt
1319 views
//----------------Sonic CD KumoKumo 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.Timer7#alias Object.Value1 : Object.YVelocity89#alias Object.PropertyValue : Object.Quality1011// Kumo Kumo Web Aliases12#alias Object.Value1 : Object.XVelocity1314// States15#alias 0 : KUMOKUMO2_AIRBORNE1617// Different Ground States for the different conditions a Kumo Kumo can come in18#alias 1 : KUMOKUMO2_GOOD_GROUND19#alias 2 : KUMOKUMO2_BAD_GROUND2021#alias 3 : KUMOKUMO2_SHOOT2223// Badnik Quality / Property Values24#alias 0 : GOOD_QUALITY25#alias 1 : BAD_QUALITY2627// SFX Aliases28#alias 2 : SFX_S_SHOT2930// Collision Sides31#alias 0 : CSIDE_FLOOR323334sub ObjectMain3536switch Object.State37case KUMOKUMO2_AIRBORNE38// This Airborne State isn't only for after jumping, but it's also what a Kumo Kumo spawns with to align it to the ground3940// Apply a Gravity of 0.25 pixels per frame41TempValue0 = 0x400042TempValue0 *= 443Object.YVelocity += TempValue04445TempValue0 = Object.YVelocity46TempValue0 *= 447Object.YPos += TempValue04849// Only check for ground collisions when going downards50if Object.YVelocity > 051ObjectTileCollision(CSIDE_FLOOR, 0, 24, 0)5253if CheckResult == true54// The Kumo Kumo has touched the ground, make it land5556// Move the Kumo Kumo 8 pixels down57Object.YPos += 0x800005859Object.Frame = 06061// Move the Kumo Kumo back to its normal Draw Order62// (In most cases this won't change anything, but for Good Kumo Kumos, this restores them after they launch a web)63Object.DrawOrder = 36465if Object.Quality == GOOD_QUALITY66Object.State = KUMOKUMO2_GOOD_GROUND67else68Object.State = KUMOKUMO2_BAD_GROUND69Object.Direction = FACING_LEFT70end if71end if72end if73break7475case KUMOKUMO2_GOOD_GROUND76if Object.Timer < 4577// Pausing before the big jump...7879Object.Timer++80Object.Frame++81Object.Frame &= 382else83// Make the Kumo Kumo jump8485// Move the Kumo Kumo 8 pixels up86Object.YPos -= 0x800008788Object.Timer = 08990// The Kumo Kumo's Velocity will be 8 pixels upwards as well91Object.YVelocity = -0x800009293Object.YPos += Object.YVelocity94Object.YVelocity += 0x40009596Object.State = KUMOKUMO2_AIRBORNE97end if98break99100case KUMOKUMO2_BAD_GROUND101if Object.Timer < 45102// Getting ready for a jump...103// Unlike a good Kumo Kumo, Bad Kumo Kumos have a rather slow animation speed when getting ready104105Object.Timer++106Object.Frame++107Object.Frame &= 7108else109// Make the Kumo Kumo jump110// However, Bad Kumo Kumos jump lower than Good Kumo Kumos111112// Move the Kumo Kumo 8 pixels up113Object.YPos -= 0x80000114115Object.Timer = 0116117// Since this is a bad Kumo Kumo, it gets a velocity of 5 pixels per frame rather than the Good variant's 8118Object.YVelocity = -0x50000119Object.YPos += Object.YVelocity120121Object.State = KUMOKUMO2_AIRBORNE122end if123break124125case KUMOKUMO2_SHOOT126if Object.Timer < 16127Object.Timer++128else129// Launch the web!130131// Create the Web Object, notably as a temp object meaning it'll be near the end of the Object List132CreateTempObject(TypeName[Kumo Kumo Web], 0, Object.XPos, Object.YPos)133134// Give the Web a high draw order, as it should draw above the Player135Object[TempObjectPos].DrawOrder = 4136137// Set its starting movement properties138if Object.Direction == FACING_RIGHT139Object[TempObjectPos].XPos += 0x80000140Object[TempObjectPos].XVelocity = 0x30000141else142Object[TempObjectPos].XPos -= 0x80000143Object[TempObjectPos].XVelocity = -0x30000144end if145146// And then make the Kumo Kumo jump147148// First, move it 8px up149Object.YPos -= 0x80000150151Object.Timer = 0152153// Its Velocity should be 8 pixels upwards per frame, as well154Object.YVelocity = -0x80000155Object.YPos += Object.YVelocity156157// But apply a small starting Gravity of 0.25 pixels, too158Object.YVelocity += 0x4000159160Object.State = KUMOKUMO2_AIRBORNE161162// Give the Kumo Kumo a high draw order, to make it match with its shot Web163Object.DrawOrder = 4164165PlayStageSfx(SFX_S_SHOT, false)166end if167break168169end switch170171// Check to see if the Kumo Kumo should become a Flower172CallFunction(StageSetup_CheckGoodFuture)173174end sub175176177sub ObjectPlayerInteraction178// Check collision for the main Badnik179PlayerObjectCollision(C_ENEMY, -24, -16, 24, 16)180if CheckResult == true181CallFunction(Player_BadnikBreak)182end if183184// Only Good Badniks are able to shoot, and they have to be on the ground too185if Object.State == KUMOKUMO2_GOOD_GROUND186187// Based on the Kumo Kumo's direction, check to see if the Player's walked in front of it188if Object.Direction == FACING_RIGHT189PlayerObjectCollision(C_TOUCH, -64, -32, 0, 16)190191if CheckResult == true192// The Player's stepped into range, turn around and shoot!193194Object.Direction = FACING_LEFT195Object.State = KUMOKUMO2_SHOOT196Object.Frame = 0197Object.Timer = 0198end if199else200PlayerObjectCollision(C_TOUCH, 0, -32, 64, 16)201202if CheckResult == true203// The Player is within range, start the shooting process204205Object.Direction = FACING_RIGHT206Object.State = KUMOKUMO2_SHOOT207Object.Frame = 0208Object.Timer = 0209end if210end if211end if212end sub213214215sub ObjectDraw216217switch Object.State218case KUMOKUMO2_AIRBORNE219if Object.Quality == GOOD_QUALITY220DrawSpriteFX(2, FX_FLIP, Object.XPos, Object.YPos)221else222DrawSpriteFX(5, FX_FLIP, Object.XPos, Object.YPos)223end if224break225226case KUMOKUMO2_GOOD_GROUND227TempValue0 = Object.Frame228TempValue0 >>= 1229DrawSpriteFX(TempValue0, FX_FLIP, Object.XPos, Object.YPos)230break231232case KUMOKUMO2_BAD_GROUND233TempValue0 = Object.Frame234TempValue0 >>= 2235TempValue0 += 3236DrawSpriteFX(TempValue0, FX_FLIP, Object.XPos, Object.YPos)237break238239case KUMOKUMO2_SHOOT240DrawSpriteFX(0, FX_FLIP, Object.XPos, Object.YPos)241break242243end switch244245end sub246247248sub ObjectStartup249250LoadSpriteSheet("R5/Objects.gif")251252SpriteFrame(-28, -20, 56, 36, 199, 1)253SpriteFrame(-28, -16, 56, 32, 199, 38)254SpriteFrame(-28, -28, 56, 52, 142, 1)255SpriteFrame(-28, -20, 56, 36, 199, 71)256SpriteFrame(-28, -16, 56, 32, 199, 108)257SpriteFrame(-28, -28, 56, 52, 142, 54)258259end sub260261262// ========================263// Editor Subs264// ========================265266sub RSDKEdit267if Editor.ReturnVariable == true268switch Editor.VariableID269case EDIT_VAR_PROPVAL // Property Value270CheckResult = Object.PropertyValue271break272case 0 // Condition273CheckResult = Object.PropertyValue274break275end switch276else277switch Editor.VariableID278case EDIT_VAR_PROPVAL // Property Value279Object.PropertyValue = Editor.VariableValue280break281case 0 // Condition282Object.PropertyValue = Editor.VariableValue283break284end switch285end if286end sub287288289sub RSDKDraw290DrawSprite(Object.PropertyValue)291end sub292293294sub RSDKLoad295LoadSpriteSheet("R5/Objects.gif")296297// Kumo Kumo Frames298299// Good Standing Frame300SpriteFrame(-28, -20, 56, 36, 199, 1)301302// Bad Standing Frame303SpriteFrame(-28, -20, 56, 36, 199, 71)304305AddEditorVariable("Condition")306SetActiveVariable("Condition")307AddEnumVariable("Good", GOOD_QUALITY)308AddEnumVariable("Bad", BAD_QUALITY)309end sub310311312313314