Path: blob/main/Scripts/Mission/Semi2.txt
1319 views
//------------------Sonic CD Semi 2 Script--------------------//1//--------Scripted by Christian Whitehead 'The Taxman'--------//2//-------Unpacked By Rubberduckycooly's Script Unpacker-------//3//-----------Used on Mission "M086 - Gotta Go Fast"-----------//45// Aliases6#alias Object.Value0 : Object.Timer7#alias Object.Value1 : Object.XVelocity8#alias Object.Value2 : Object.YVelocity9#alias Object.Value3 : Object.XOriginPos10#alias Object.Value4 : Object.YOriginPos11#alias Object.PropertyValue : Object.Quality1213// States14#alias 0 : SEMI_IDLE15#alias 1 : SEMI_START_FLY16#alias 2 : SEMI_BOMB_THROW17#alias 3 : SEMI_RESET1819// Badnik Quality / Property Values20#alias 0 : GOOD_QUALITY21#alias 1 : BAD_QUALITY2223// Priority24#alias 0 : PRIORITY_BOUNDS25#alias 1 : PRIORITY_ACTIVE262728sub ObjectMain29if Object.OutOfBounds == true30Object.State = SEMI_RESET31Object.Timer = 032Object.XPos = Object.XOriginPos33Object.YPos = Object.YOriginPos34end if3536switch Object.State37case SEMI_START_FLY38Object.Priority = PRIORITY_ACTIVE39Object.XPos += Object.XVelocity40Object.YPos += Object.YVelocity41if Object.Timer < 4842Object.Timer++43else44Object.Timer = 045Object.State++46end if47break4849case SEMI_BOMB_THROW50Object.XPos += Object.XVelocity51if Object.Quality == GOOD_QUALITY52if Object.Timer == 053Object.Timer = 3054CreateTempObject(TypeName[SemiBomb2], 0, Object.XPos, Object.YPos)55Object[TempObjectPos].YPos += 0xC000056else57Object.Timer--58end if59end if60break6162case SEMI_RESET63if Object.OutOfBounds == true64Object.State = SEMI_IDLE65Object.Priority = PRIORITY_BOUNDS66end if67break68end switch69// Check if this badnik should be a flower70CallFunction(StageSetup_CheckGoodFuture)71end sub727374sub ObjectPlayerInteraction75switch Object.State76case SEMI_IDLE77PlayerObjectCollision(C_TOUCH, -96, -128, 96, 128)78if CheckResult == true79Object.State = SEMI_START_FLY80if Object.XPos > Player.XPos81if Object.Quality == GOOD_QUALITY82Object.XVelocity = 0x2000083Object.YVelocity = -0x1000084else85Object.XVelocity = 0x1800086Object.YVelocity = 0xC00087end if88else89if Object.Quality == GOOD_QUALITY90Object.XVelocity = -0x2000091Object.YVelocity = -0x1000092else93Object.XVelocity = -0x1800094Object.YVelocity = 0xC00095end if96end if97end if98break99100case SEMI_START_FLY101case SEMI_BOMB_THROW102PlayerObjectCollision(C_ENEMY, -14, -12, 14, 12)103if CheckResult == true104CallFunction(Player_BadnikBreak)105end if106break107end switch108end sub109110111sub ObjectDraw112switch Object.State113case SEMI_IDLE114DrawSprite(Object.Quality)115break116117case SEMI_START_FLY118case SEMI_BOMB_THROW119TempValue0 = Object.Frame120TempValue0 >>= 2121122if Object.Quality == GOOD_QUALITY123TempValue0 += 2124else125TempValue0 += 6126end if127128if Object.Frame > 7129Object.Direction = FACING_LEFT130else131Object.Direction = FACING_RIGHT132end if133134DrawSpriteFX(TempValue0, FX_FLIP, Object.XPos, Object.YPos)135Object.Frame++136Object.Frame &= 15137break138end switch139end sub140141142sub ObjectStartup143LoadSpriteSheet("R6/Objects.gif")144// Good145SpriteFrame(-16, -16, 32, 32, 1, 224) // #0 - Semi146// Bad147SpriteFrame(-16, -16, 32, 32, 158, 166) // #1 - Semi148// Good149SpriteFrame(-16, -16, 32, 32, 34, 224) // #2 - Semi Good150SpriteFrame(-20, -16, 40, 32, 67, 224)151SpriteFrame(-16, -16, 32, 32, 34, 224)152SpriteFrame(-20, -16, 40, 32, 67, 224)153// Bad154SpriteFrame(-16, -16, 32, 32, 108, 224)155SpriteFrame(-20, -16, 40, 32, 141, 224)156SpriteFrame(-16, -16, 32, 32, 108, 224)157SpriteFrame(-20, -16, 40, 32, 141, 224)158159ArrayPos0=32160while ArrayPos0 < 1056161if Object[ArrayPos0].Type == TypeName[Semi]162Object[ArrayPos0].Type=TypeName[Semi2]163end if164if Object[ArrayPos0].Type == TypeName[Semi2]165Object[ArrayPos0].XOriginPos = Object[ArrayPos0].XPos166Object[ArrayPos0].YOriginPos = Object[ArrayPos0].YPos167Object[ArrayPos0].DrawOrder = 5168end if169ArrayPos0++170loop171end sub172173174// ========================175// Editor Subs176// ========================177178sub RSDKEdit179if Editor.ReturnVariable == true180switch Editor.VariableID181case EDIT_VAR_PROPVAL // Property Value182CheckResult = Object.PropertyValue183CheckResult &= 1184break185case 0 // condition186CheckResult = Object.PropertyValue187CheckResult &= 1188break189end switch190else191switch Editor.VariableID192case EDIT_VAR_PROPVAL // Property Value193Object.PropertyValue = Editor.VariableValue194Object.PropertyValue &= 1195break196case 0 // condition197Object.PropertyValue = Editor.VariableValue198Object.PropertyValue &= 1199break200end switch201end if202end sub203204sub RSDKDraw205DrawSprite(Object.PropertyValue)206end sub207208sub RSDKLoad209LoadSpriteSheet("R6/Objects.gif")210211// Good212SpriteFrame(-16, -16, 32, 32, 1, 224) // #0 - Semi213// Bad214SpriteFrame(-16, -16, 32, 32, 158, 166) // #1 - Semi215216AddEditorVariable("condition")217SetActiveVariable("condition")218AddEnumVariable("Good Quality", GOOD_QUALITY)219AddEnumVariable("Bad Quality", BAD_QUALITY)220end sub221222223224225226