Path: blob/main/Scripts/R3/RotatingSpikes.txt
1319 views
//--------------Sonic CD Rotating Spikes Script---------------//1//--------Scripted by Christian Whitehead 'The Taxman'--------//2//-------Unpacked By Rubberduckycooly's Script Unpacker-------//34// Aliases5#alias Object.Value0 : Object.Angle6#alias Object.Value1 : Object.Speed7#alias Object.Value2 : Object.SpawnedSpikes89// HUD Alias10#alias Object[24].PropertyValue : HUD.CurrentTimePeriod1112// Property Values13#alias 0 : MAXSPIKES_RIGHT14#alias 1 : MAXSPIKES_LEFT15#alias 2 : TWO_SPIKES_RIGHT16#alias 3 : TWO_SPIKES_LEFT1718// Time Periods19#alias 1 : TIME_PAST202122sub ObjectMain23Object.Angle += Object.Speed24if Object.Angle < 025Object.Angle += 51226end if27Object.Angle &= 51128end sub293031sub ObjectPlayerInteraction32TempValue0 = 033TempValue1 = 1634TempValue2 = Object.XPos35TempValue3 = Object.YPos3637while TempValue0 < Object.SpawnedSpikes3839Cos(Object.XPos, Object.Angle)40Object.XPos *= TempValue141Object.XPos <<= 742Object.XPos += TempValue24344Sin(Object.YPos, Object.Angle)45Object.YPos *= TempValue146Object.YPos <<= 747Object.YPos += TempValue34849PlayerObjectCollision(C_TOUCH, -8, -8, 8, 8)50if CheckResult == true51CallFunction(Player_Hit)52end if5354TempValue0++55TempValue1 += 1656loop57Object.XPos = TempValue258Object.YPos = TempValue359end sub606162sub ObjectDraw63DrawSprite(0)6465TempValue0 = 066TempValue1 = 1667while TempValue0 < Object.SpawnedSpikes6869Cos(TempValue2, Object.Angle)70TempValue2 *= TempValue171TempValue2 <<= 772TempValue2 += Object.XPos7374Sin(TempValue3, Object.Angle)75TempValue3 *= TempValue176TempValue3 <<= 777TempValue3 += Object.YPos7879DrawSpriteXY(1, TempValue2, TempValue3)8081TempValue0++82TempValue1 += 1683loop84end sub858687sub ObjectStartup88LoadSpriteSheet("R3/Objects.gif")8990SpriteFrame(-8, -8, 16, 16, 181, 143) // #0 - Spike Joint91SpriteFrame(-8, -8, 16, 16, 181, 160) // #1 - Spike9293ArrayPos0 = 3294while ArrayPos0 < 105695if Object[ArrayPos0].Type == TypeName[Rotating Spikes]96switch Object[ArrayPos0].PropertyValue97case MAXSPIKES_RIGHT98Object[ArrayPos0].Speed = 299if HUD.CurrentTimePeriod > 1 // In the future it has 4 spikes100Object[ArrayPos0].SpawnedSpikes = 4101else102Object[ArrayPos0].SpawnedSpikes = 3103end if104break105106case MAXSPIKES_LEFT107Object[ArrayPos0].Speed = -2108if HUD.CurrentTimePeriod > 1 // In the future it has 4 spikes109Object[ArrayPos0].SpawnedSpikes = 4110else111Object[ArrayPos0].SpawnedSpikes = 3112end if113break114115case TWO_SPIKES_RIGHT116Object[ArrayPos0].Speed = 2117Object[ArrayPos0].SpawnedSpikes = 2118break119120case TWO_SPIKES_LEFT121Object[ArrayPos0].Speed = -2122Object[ArrayPos0].SpawnedSpikes = 2123break124125end switch126end if127ArrayPos0++128loop129end sub130131132// ========================133// Editor Subs134// ========================135136sub RSDKEdit137if Editor.ReturnVariable == true138switch Editor.VariableID139case EDIT_VAR_PROPVAL // Property Value140CheckResult = Object.PropertyValue141CheckResult &= 3142break143case 0 // spikeType144CheckResult = Object.PropertyValue145CheckResult &= 3146break147end switch148else149switch Editor.VariableID150case EDIT_VAR_PROPVAL // Property Value151Object.PropertyValue = Editor.VariableValue152Object.PropertyValue &= 3153break154case 0 // spikeType155Object.PropertyValue = Editor.VariableValue156Object.PropertyValue &= 3157break158end switch159end if160end sub161162163sub RSDKDraw164DrawSprite(0)165166TempValue0 = 0167if Object.PropertyValue > 1168TempValue1 = 2169else170CheckCurrentStageFolder("B")171if CheckResult == true172TempValue1 = 3173else174TempValue1 = 4175end if176end if177178TempValue2 = Object.XPos179TempValue3 = Object.YPos180while TempValue0 < TempValue1181TempValue2 += 0x100000182TempValue3 += 0x100000183DrawSpriteXY(1, TempValue2, TempValue3)184TempValue0++185loop186187if Editor.ShowGizmos == true188switch Object.PropertyValue189case 0190case 2191TempValue0 = Object.iXPos192TempValue0 += 32193TempValue0 <<= 16194195TempValue1 = Object.iYPos196TempValue1 += 32197TempValue1 <<= 16198DrawArrow(TempValue0, Object.YPos, Object.XPos, TempValue1, 255, 255, 255, 0)199break200case 1201case 3202TempValue0 = Object.iXPos203TempValue0 += 32204TempValue0 <<= 16205206TempValue1 = Object.iYPos207TempValue1 += 32208TempValue1 <<= 16209DrawArrow(Object.XPos, TempValue1, TempValue0, Object.YPos, 255, 255, 255, 0)210break211end switch212end if213end sub214215216sub RSDKLoad217LoadSpriteSheet("R3/Objects.gif")218219SpriteFrame(-8, -8, 16, 16, 181, 143) // #0 - Spike Joint220SpriteFrame(-8, -8, 16, 16, 181, 160) // #1 - Spike221222CheckCurrentStageFolder("B")223AddEditorVariable("spikeType")224SetActiveVariable("spikeType")225if CheckResult == true226AddEnumVariable("3 Spikes Clock-wise", 0)227AddEnumVariable("3 Spikes Counter Clock-wise", 1)228else229AddEnumVariable("4 Spikes Clock-wise", 0)230AddEnumVariable("4 Spikes Counter Clock-wise", 1)231end if232AddEnumVariable("2 Spikes Clock-wise", 2)233AddEnumVariable("2 Spikes Counter Clock-wise", 3)234end sub235236237