Path: blob/main/Scripts/DAGarden/CharacterSpawn.txt
1319 views
//--------------Sonic CD Character Spawn 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.SpawnList7#alias Object.Value2 : Object.SpawnType // Set by BGAnimation89// Blue Bird/ Slow Bird Alias10#alias Object.Value2 : Object.Wobble11#alias Object.PropertyValue : Object.WobbleIncrease1213// Spawn List14// 0 - Blue Bird15// 1, 4, 10 - Tornado16// 2, 5, 9 - Blue Bird/Shooting Star17// 3, 8 - Metal Sonic18// 6, 11 - UFO19// 7, 12 - Eggman2021// States22#alias 0 : CHARACTERSPAWN_SETUP23#alias 1 : CHARACTERSPAWN_SPAWNER2425// UFO Property Values26#alias 0 : GREEN_UFO27#alias 3 : YELLOW_UFO2829// Shooting Star Property Values30#alias 0 : WHITE_STAR31#alias 6 : GREEN_STAR3233#function CharacterSpawn_SpawnBlueBird34#function CharacterSpawn_SpawnShootStar35#function CharacterSpawn_SpawnSetup3637function CharacterSpawn_SpawnBlueBird38//Base YPos39Rand(TempValue4, 64)40TempValue4 -= 3241TempValue4 += 1204243TempValue5 = 044while TempValue1 > 145// Random XPos46Rand(TempValue2, 64)47TempValue2 -= 3248TempValue2 += TempValue049TempValue2 <<= 1650// Random YPos51Rand(TempValue3, 96)52TempValue3 -= 4853TempValue3 += TempValue454TempValue3 <<= 165556CreateTempObject(TypeName[Blue Bird], 0, TempValue2, TempValue3)57if TempValue0 < Screen.CenterX58Object[TempObjectPos].Direction = FACING_RIGHT59else60Object[TempObjectPos].Direction = FACING_LEFT61end if62Object[TempObjectPos].Wobble = TempValue5 // Set the base wobble value63TempValue5 += 864// Set the wobble increment value65Rand(Object[TempObjectPos].WobbleIncrease, 10)66Object[TempObjectPos].WobbleIncrease += 367TempValue1--68loop69// Spawn one slower blue bird70// Random XPos71Rand(TempValue2, 64)72TempValue2 -= 3273TempValue2 += TempValue074TempValue2 <<= 1675// Random YPos76Rand(TempValue3, 96)77TempValue3 -= 4878TempValue3 += TempValue479TempValue3 <<= 168081CreateTempObject(TypeName[Slow Bird], 0, TempValue2, TempValue3)82if TempValue0 < Screen.CenterX83Object[TempObjectPos].Direction = FACING_RIGHT84else85Object[TempObjectPos].Direction = FACING_LEFT86end if87Object[TempObjectPos].Wobble = TempValue5 // Set the base wobble value88TempValue5 += 889// Set the wobble increment value90Rand(Object[TempObjectPos].WobbleIncrease, 10)91Object[TempObjectPos].WobbleIncrease += 392TempValue1--93end function949596function CharacterSpawn_SpawnShootStar97while TempValue1 > 098// Random XPos99Rand(TempValue2, 256)100TempValue2 -= 64101TempValue2 += Screen.CenterX102TempValue2 <<= 16103104// Random YPos105Rand(TempValue3, 80)106TempValue3 -= 96107TempValue3 <<= 16108109// Define the color of the shooting star110Rand(TempValue4, 10)111if TempValue4 > 5112CreateTempObject(TypeName[Shooting Star], GREEN_STAR, TempValue2, TempValue3)113else114CreateTempObject(TypeName[Shooting Star], WHITE_STAR, TempValue2, TempValue3)115end if116TempValue1--117loop118end function119120121function CharacterSpawn_SpawnSetup122switch Object.SpawnList123case 0124// Set Base XPos125TempValue0 = Screen.XSize126TempValue0 += 96127TempValue1 = 8128CallFunction(CharacterSpawn_SpawnBlueBird)129Object.SpawnList++130break131132case 1133// Set Base XPos134TempValue0 = Screen.XSize135TempValue0 += 48136TempValue0 <<= 16137CreateTempObject(TypeName[Tails Biplane], 0, TempValue0, Object.YPos)138Object[TempObjectPos].Direction = FACING_LEFT139Object.SpawnList++140break141142case 2143if Object.SpawnType == 0144// Set Base XPos145TempValue0 = 0146TempValue0 -= 96147TempValue1 = 6148CallFunction(CharacterSpawn_SpawnBlueBird)149else150TempValue1 = 3 // Set the amount of stars to spawn151CallFunction(CharacterSpawn_SpawnShootStar)152end if153Object.SpawnList++154break155156case 3157// Set XPos158Rand(TempValue0, 320)159TempValue0 -= 160160TempValue0 += Screen.CenterX161TempValue0 <<= 16162// Determine if spawns from the top or bottom of the screen163Rand(TempValue1, 64)164if TempValue1 > 40165CreateTempObject(TypeName[Metal Sonic], 0, TempValue0, 0x10C0000)166else167CreateTempObject(TypeName[Metal Sonic], 0, TempValue0, -0x400000)168end if169Object.SpawnList++170break171172case 4173CreateTempObject(TypeName[Tails Biplane], 0, Object.XPos, Object.YPos)174Object.SpawnList++175break176177case 5178if Object.SpawnType == 0179// Set Base XPos180TempValue0 = 0181TempValue0 -= 96182TempValue1 = 4183CallFunction(CharacterSpawn_SpawnBlueBird)184else185TempValue1 = 4 // Set the amount of stars to spawn186CallFunction(CharacterSpawn_SpawnShootStar)187end if188Object.SpawnList++189break190191case 6192// Set Base XPos193TempValue0 = Screen.XSize194TempValue0 += 48195TempValue0 <<= 16196CreateTempObject(TypeName[UFO], YELLOW_UFO, TempValue0, Object.YPos)197Object[TempObjectPos].Direction = FACING_LEFT198Object.SpawnList++199break200201case 7202// Set Base XPos203TempValue0 = Screen.XSize204TempValue0 += 48205TempValue0 <<= 16206CreateTempObject(TypeName[Dr Eggman], 6, TempValue0, 0xC00000)207Object[TempObjectPos].Direction = FACING_RIGHT208Object.SpawnList++209break210211case 8212// Set Base XPos213Rand(TempValue0, 320)214TempValue0 -= 160215TempValue0 += Screen.CenterX216TempValue0 <<= 16217// Determine if spawns from the top or bottom of the screen218Rand(TempValue1, 64)219if TempValue1 > 40220CreateTempObject(TypeName[Metal Sonic], 0, TempValue0, 0x10C0000)221else222CreateTempObject(TypeName[Metal Sonic], 0, TempValue0, -0x400000)223end if224Object.SpawnList++225break226227case 9228if Object.SpawnType == 0229// Set Base XPos230TempValue0 = Screen.XSize231TempValue0 += 96232TempValue1 = 8233CallFunction(CharacterSpawn_SpawnBlueBird)234else235TempValue1 = 2 // Set the amount of stars to spawn236CallFunction(CharacterSpawn_SpawnShootStar)237end if238Object.SpawnList++239break240241case 10242// Set Base XPos243TempValue0 = Screen.XSize244TempValue0 += 48245TempValue0 <<= 16246CreateTempObject(TypeName[Tails Biplane], 0, TempValue0, Object.YPos)247Object[TempObjectPos].Direction = FACING_LEFT248Object.SpawnList++249break250251case 11252CreateTempObject(TypeName[UFO], GREEN_UFO, Object.XPos, Object.YPos)253CreateTempObject(TypeName[UFO], YELLOW_UFO, Object.XPos, Object.YPos)254Object.SpawnList++255break256257case 12258// Set Base XPos259TempValue0 = -48260TempValue0 <<= 16261CreateTempObject(TypeName[Dr Eggman], 6, TempValue0, 0xC00000)262Object[TempObjectPos].Direction = FACING_LEFT263Object.SpawnList = 0264break265266end switch267end function268269270sub ObjectMain271switch Object.State272case CHARACTERSPAWN_SETUP273CreateTempObject(TypeName[Tails Biplane], 0, Object.XPos, Object.YPos)274Object.Timer = 380275Object.State++276break277278case CHARACTERSPAWN_SPAWNER279if Object.Timer > 0280Object.Timer--281else282Rand(Object.Timer, 480)283Object.Timer += 240284CallFunction(CharacterSpawn_SpawnSetup)285end if286break287288end switch289end sub290291292// ========================293// Editor Subs294// ========================295296sub RSDKDraw297DrawSprite(0)298end sub299300301sub RSDKLoad302LoadSpriteSheet("Global/Display.gif")303SpriteFrame(-16, -16, 32, 32, 1, 143) // #0 - "Script" Icon304305SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")306end sub307308309