Path: blob/main/Scripts/R6/IceBlock.txt
1319 views
//-----------------Sonic CD Ice Block 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.XVelocity7#alias Object.Value2 : Object.YVelocity89// States10#alias 0 : ICEBLOCK_FALLING11#alias 1 : ICEBLOCK_BREAKICE1213// Stage SFX14#alias 4 : SFX_S_GLASSSMASH1516// Property Values17#alias 0 : CHARACTER_ICEBLOCK18#alias 1 : BIG_CHUNK_ICEBLOCK19#alias 2 : MEDIUM_CHUNK_ICEBLOCK20#alias 3 : CENTRAL_CHUNK_ICEBLOCK // Used, but it doesn't do anything21#alias 4 : SMALL_CHUNK_ICEBLOCK2223// Collision Sides24#alias 0 : CSIDE_FLOOR2526// Players27#alias 0 : PLAYER_SONIC_A28#alias 1 : PLAYER_TAILS_A2930// Directions31#alias 2 : FACING_UPEND_RIGHT32#alias 3 : FACING_UPEND_LEFT3334// Function declarations35#function IceBlock_CreateIceChunks363738function IceBlock_CreateIceChunks39CreateTempObject(TypeName[Ice Block], BIG_CHUNK_ICEBLOCK, Object.XPos, Object.YPos)40Object[TempObjectPos].DrawOrder = 441Object[TempObjectPos].XPos -= 0x11000042Object[TempObjectPos].YPos -= 0xD000043Object[TempObjectPos].XVelocity = -0x1000044Object[TempObjectPos].YVelocity = -0x1000045Object[TempObjectPos].Direction = FACING_RIGHT4647CreateTempObject(TypeName[Ice Block], BIG_CHUNK_ICEBLOCK, Object.XPos, Object.YPos)48Object[TempObjectPos].DrawOrder = 449Object[TempObjectPos].XPos += 0x11000050Object[TempObjectPos].YPos -= 0xD000051Object[TempObjectPos].XVelocity = 0x1000052Object[TempObjectPos].YVelocity = -0x1000053Object[TempObjectPos].Direction = FACING_LEFT5455CreateTempObject(TypeName[Ice Block], BIG_CHUNK_ICEBLOCK, Object.XPos, Object.YPos)56Object[TempObjectPos].DrawOrder = 457Object[TempObjectPos].XPos -= 0x11000058Object[TempObjectPos].YPos += 0xD000059Object[TempObjectPos].XVelocity = -0x1000060Object[TempObjectPos].YVelocity = 0x1000061Object[TempObjectPos].Direction = FACING_UPEND_RIGHT6263CreateTempObject(TypeName[Ice Block], BIG_CHUNK_ICEBLOCK, Object.XPos, Object.YPos)64Object[TempObjectPos].DrawOrder = 465Object[TempObjectPos].XPos += 0x11000066Object[TempObjectPos].YPos += 0xD000067Object[TempObjectPos].XVelocity = 0x1000068Object[TempObjectPos].YVelocity = 0x1000069Object[TempObjectPos].Direction = FACING_UPEND_LEFT7071CreateTempObject(TypeName[Ice Block], CENTRAL_CHUNK_ICEBLOCK, Object.XPos, Object.YPos)72Object[TempObjectPos].DrawOrder = 473Object[TempObjectPos].Direction = FACING_RIGHT7475CreateTempObject(TypeName[Ice Block], MEDIUM_CHUNK_ICEBLOCK, Object.XPos, Object.YPos)76Object[TempObjectPos].DrawOrder = 477Object[TempObjectPos].YPos -= 0x11000078Object[TempObjectPos].YVelocity = -0x1000079Object[TempObjectPos].Direction = FACING_LEFT8081CreateTempObject(TypeName[Ice Block], MEDIUM_CHUNK_ICEBLOCK, Object.XPos, Object.YPos)82Object[TempObjectPos].DrawOrder = 483Object[TempObjectPos].YPos += 0x11000084Object[TempObjectPos].YVelocity = 0x1000085Object[TempObjectPos].Direction = FACING_UPEND_LEFT868788#platform: Use_Haptics89HapticEffect(11, 0, 0, 0)90#endplatform9192end function939495sub ObjectMain96switch Object.PropertyValue97case CHARACTER_ICEBLOCK98if Object.State == ICEBLOCK_FALLING99Object.YPos += Object.YVelocity100Object.YVelocity += Player.GravityStrength101if Object.YVelocity > 0x140000102Object.YVelocity = 0x140000103end if104105ObjectTileCollision(CSIDE_FLOOR, 0, 24, 0)106if CheckResult == true107Object.State = ICEBLOCK_BREAKICE108Object.YVelocity = 0109PlayStageSfx(SFX_S_GLASSSMASH, false)110end if111112#platform: Use_Origins113if CheckResult == false114ObjectTileCollision(CSIDE_FLOOR, 0, 22, 0)115if CheckResult == true116Object.State = ICEBLOCK_BREAKICE117Object.YVelocity = 0118PlayStageSfx(SFX_S_GLASSSMASH, 0)119end if120end if121#endplatform122Player.XPos = Object.XPos123Player.YPos = Object.YPos124else125if Object.Timer < 16126Object.Timer++127if Object[0].Type == TypeName[PlayerObject]128if Player.JumpPress == true129CallFunction(IceBlock_CreateIceChunks)130Object.Type = TypeName[Blank Object]131132CallFunction(Player_Action_Jump)133134Player.Visible = true135Player.ObjectInteraction = true136end if137end if138else139CallFunction(IceBlock_CreateIceChunks)140Object.Type = TypeName[Blank Object]141142#platform: Use_Origins143Player.State = Player_State_Air_NoDropDash144#endplatform145146#platform: Use_Standalone147Player.State = Player_State_Air148#endplatform149CallFunction(Player_Hit)150151Player.Visible = true152Player.ObjectInteraction = true153end if154end if155break156157case BIG_CHUNK_ICEBLOCK158if Object.Timer < 10159Object.Timer++160Object.XPos += Object.XVelocity161Object.YPos += Object.YVelocity162else163Object.Type = TypeName[Blank Object]164CreateTempObject(TypeName[Ice Block], SMALL_CHUNK_ICEBLOCK, Object.XPos, Object.YPos)165Object[TempObjectPos].DrawOrder = 4166Object[TempObjectPos].XVelocity = 0167Object[TempObjectPos].YVelocity = -0x10000168169CreateTempObject(TypeName[Ice Block], SMALL_CHUNK_ICEBLOCK, Object.XPos, Object.YPos)170Object[TempObjectPos].DrawOrder = 4171Object[TempObjectPos].XVelocity = -0x10000172Object[TempObjectPos].YVelocity = 0173174CreateTempObject(TypeName[Ice Block], SMALL_CHUNK_ICEBLOCK, Object.XPos, Object.YPos)175Object[TempObjectPos].DrawOrder = 4176Object[TempObjectPos].XVelocity = 0x10000177Object[TempObjectPos].YVelocity = 0178179CreateTempObject(TypeName[Ice Block], SMALL_CHUNK_ICEBLOCK, Object.XPos, Object.YPos)180Object[TempObjectPos].DrawOrder = 4181Object[TempObjectPos].XVelocity = 0182Object[TempObjectPos].YVelocity = 0x10000183end if184break185186case MEDIUM_CHUNK_ICEBLOCK187if Object.Timer < 16188Object.Timer++189Object.XPos += Object.XVelocity190Object.YPos += Object.YVelocity191else192Object.Type = TypeName[Blank Object]193CreateTempObject(TypeName[Ice Block], SMALL_CHUNK_ICEBLOCK, Object.XPos, Object.YPos)194Object[TempObjectPos].DrawOrder = 4195Object[TempObjectPos].XVelocity = 0196Object[TempObjectPos].YVelocity = -0x10000197198CreateTempObject(TypeName[Ice Block], SMALL_CHUNK_ICEBLOCK, Object.XPos, Object.YPos)199Object[TempObjectPos].DrawOrder = 4200Object[TempObjectPos].XVelocity = -0x10000201Object[TempObjectPos].YVelocity = 0x10000202203CreateTempObject(TypeName[Ice Block], SMALL_CHUNK_ICEBLOCK, Object.XPos, Object.YPos)204Object[TempObjectPos].DrawOrder = 4205Object[TempObjectPos].XVelocity = 0x10000206Object[TempObjectPos].YVelocity = 0x10000207end if208break209210case CENTRAL_CHUNK_ICEBLOCK211if Object.Timer < 1212Object.Timer++213else214Object.Type = TypeName[Blank Object]215end if216break217218case SMALL_CHUNK_ICEBLOCK219if Object.Timer < 12220Object.Timer++221Object.XPos += Object.XVelocity222Object.YPos += Object.YVelocity223else224Object.Type = TypeName[Blank Object]225end if226break227end switch228end sub229230231sub ObjectDraw232DrawSpriteFX(Object.PropertyValue, FX_FLIP, Object.XPos, Object.YPos)233end sub234235236sub ObjectStartup237// #0 - Character Ice Block238// #1 - Ice Chunk (Big)239// #2 - Ice Chunk (Medium)240// #3 - Ice Chunk (Medium)241// #4 - Ice Chunk (Small)242243if Stage.PlayerListPos == PLAYER_SONIC_A244LoadSpriteSheet("R6/Objects.gif")245SpriteFrame(-24, -24, 48, 48, 34, 18)246SpriteFrame(-8, -12, 16, 24, 206, 1)247SpriteFrame(-8, -8, 16, 16, 66, 1)248SpriteFrame(-8, -8, 16, 16, 66, 1)249SpriteFrame(-4, -4, 8, 8, 34, 67)250end if251252if Stage.PlayerListPos == PLAYER_TAILS_A253LoadSpriteSheet("R6/Objects3.gif")254SpriteFrame(-24, -24, 48, 48, 1, 101)255SpriteFrame(-8, -12, 16, 24, 50, 86)256SpriteFrame(-8, -8, 16, 16, 50, 111)257SpriteFrame(-8, -8, 16, 16, 50, 111)258SpriteFrame(-4, -4, 8, 8, 50, 128)259end if260#platform: Use_Origins261if Stage.PlayerListPos == PLAYER_KNUCKLES262LoadSpriteSheet("R6/Objects4.gif")263SpriteFrame(-24, -24, 48, 48, 1, 194)264SpriteFrame(-8, -12, 16, 24, 99, 194)265SpriteFrame(-8, -8, 16, 16, 99, 219)266SpriteFrame(-8, -8, 16, 16, 99, 219)267SpriteFrame(-4, -4, 8, 8, 99, 236)268end if269270if Stage.PlayerListPos == PLAYER_AMY271LoadSpriteSheet("R6/Objects4.gif")272SpriteFrame(-24, -24, 48, 48, 50, 194)273SpriteFrame(-8, -12, 16, 24, 99, 194)274SpriteFrame(-8, -8, 16, 16, 99, 219)275SpriteFrame(-8, -8, 16, 16, 99, 219)276SpriteFrame(-4, -4, 8, 8, 99, 236)277end if278#endplatform279end sub280281282// ========================283// Editor Subs284// ========================285286sub RSDKDraw287DrawSprite(0)288end sub289290291sub RSDKLoad292LoadSpriteSheet("R6/Objects.gif")293294SpriteFrame(-24, -24, 48, 48, 34, 18) // #0 - Sonic Ice Block295296SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")297end sub298299300