Path: blob/main/Scripts/R5/BossSpikes.txt
1319 views
//----------------Sonic CD Boss Spikes Script-----------------//1//--------Scripted by Christian Whitehead 'The Taxman'--------//2//-------Unpacked By Rubberduckycooly's Script Unpacker-------//34// Aliases5#alias Object.Value0 : Object.Timer67// Boss Top Aliases8#alias Object.Value1 : Object.BoundsR9#alias Object.Value2 : Object.OldBoundsR1011#alias Object[24].PropertyValue : HUD.CurrentTimePeriod1213// States14#alias 0 : BOSSSPIKES_AWAITPLAYER15#alias 1 : BOSSSPIKES_AWAITARENAENTER16#alias 2 : BOSSSPIKES_RAISE17#alias 3 : BOSSSPIKES_ADVANCE18#alias 4 : BOSSSPIKES_STAND1920// Time Periods21#alias 3 : TIME_BAD_FUTURE2223// Priority24#alias 0 : PRIORITY_BOUNDS25#alias 1 : PRIORITY_ACTIVE262728sub ObjectMain2930switch Object.State31case BOSSSPIKES_AWAITPLAYER32if Player.XPos > Object.XPos3334// Initalise the arena3536// Backup the Stage's normal right bounds into the Boss Top's Values37Object[+3].OldBoundsR = Stage.XBoundary23839// Set left bounds40Stage.NewXBoundary1 = Object.iXPos41Stage.NewXBoundary1 += 32842Stage.NewXBoundary1 -= Screen.CenterX4344// And right bounds45Stage.NewXBoundary2 = Stage.NewXBoundary146Stage.NewXBoundary2 += Screen.CenterX4748// Set the Boss Top's49Object[+3].BoundsR = Stage.NewXBoundary250Object[+3].BoundsR += 16051Object[+3].BoundsR <<= 165253Stage.NewXBoundary2 += Screen.CenterX54Stage.NewYBoundary2 = Object.iYPos55Object.State = BOSSSPIKES_AWAITARENAENTER56Object.Priority = PRIORITY_ACTIVE5758// Remove the Conveyer Belts controller Object59ResetObjectEntity(19, TypeName[Blank Object], 0, 0, 0)6061// And make the default palette be used too, rather than whatever the Conveyer Belt's current palette frame was62SetActivePalette(0, 0, Screen.YSize)63end if64break6566case BOSSSPIKES_AWAITARENAENTER67TempValue0 = Object.XPos68TempValue0 += 0x30000069if Player.XPos > TempValue070Object.State = BOSSSPIKES_RAISE71end if72break7374case BOSSSPIKES_RAISE75if Object.Timer < 6476Object.Timer += 277Object.YPos -= 0x2000078else79Object.Timer = 080Object.State = BOSSSPIKES_ADVANCE81end if82break8384case BOSSSPIKES_ADVANCE85if Object.Timer < 19286Object.Timer += 287Object.XPos += 0x2000088else89Object.Timer = 090Object.State = BOSSSPIKES_STAND91Object.Priority = PRIORITY_BOUNDS92end if93break9495end switch9697end sub9899100sub ObjectPlayerInteraction101102if Object.State < BOSSSPIKES_RAISE103104// Just act as a box for the player105PlayerObjectCollision(C_BOX, -24, -32, 0, 32)106107else108109// See if the player is within range of behind the Spike Wall110PlayerObjectCollision(C_TOUCH, -64, -32, 0, 32)111112if CheckResult == true113114// If they are, then move them to be in front instead115Player.XPos = Player.CollisionRight116Player.XPos <<= 16117Player.XPos += Object.XPos118119end if120end if121122// Check collision for the Spikes side of things123PlayerObjectCollision(C_TOUCH, 0, -32, 24, 32)124125if CheckResult == true126CallFunction(Player_Hit)127128if Player.State == Player_State_GotHit129// If Sonic's been hurt, then set the Boss Platform's130Object[+6].Value3 = 0xC000131end if132133end if134end sub135136137sub ObjectDraw138DrawSprite(0)139end sub140141142sub ObjectStartup143LoadSpriteSheet("R5/Objects2.gif")144if HUD.CurrentTimePeriod < 3 // Present Past or Future145SpriteFrame(-24, -32, 48, 64, 125, 191)146else147SpriteFrame(-24, -32, 48, 64, 76, 191)148end if149end sub150151152// ========================153// Editor Subs154// ========================155156sub RSDKDraw157DrawSprite(0)158end sub159160161sub RSDKLoad162LoadSpriteSheet("R5/Objects2.gif")163SpriteFrame(-24, -32, 48, 64, 125, 191)164165SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")166end sub167168169