Path: blob/master/Sonic 1/Scripts/Global/BubbleShield.txt
1482 views
// ----------------------------------1// RSDK Project: Sonic 12// Script Description: Bubble Shield Object3// Script Author: Christian Whitehead/Simon Thomley4// Unpacked by Rubberduckycooly's script unpacker5// ----------------------------------67// ========================8// Aliases9// ========================1011private alias object.value0 : object.timer1213private alias 0 : BUBBLESHIELD_IDLE_SETUP14private alias 1 : BUBBLESHIELD_IDLE15private alias 2 : BUBBLESHIELD_BOUNCE_SETUP16private alias 3 : BUBBLESHIELD_BOUNCE17private alias 4 : BUBBLESHIELD_RECOIL_SETUP18private alias 5 : BUBBLESHIELD_RECOIL1920private alias -1 : DRAWORDER_PLAYER2122private alias object.state : player.state23private alias object.xpos : player.xpos24private alias object.ypos : player.ypos2526// Super States27private alias 1 : SUPERSTATE_SUPER282930// ========================31// Tables32// ========================3334private table BubbleShield_frameTable352, 0, 2, 0, 2, 0, 3, 1, 3, 1, 3, 1, 4, 0, 4, 0364, 0, 5, 1, 5, 1, 5, 1, 6, 0, 6, 0, 6, 0, 5, 1375, 1, 5, 1, 4, 0, 4, 0, 4, 0, 3, 1, 3, 1, 3, 1382, 0, 2, 0, 2, 039end table404142// ========================43// Events44// ========================4546event ObjectUpdate47// Remove the shield if the player shouldn't have it48if player[-playerCount].state == Player_State_Death49object.type = TypeName[Blank Object]50end if5152if player[-playerCount].state == Player_State_Drown53object.type = TypeName[Blank Object]54end if5556object.drawOrder = DRAWORDER_PLAYER575859switch object.state60case BUBBLESHIELD_IDLE_SETUP61object.animationTimer = 062object.timer = 063GetTableValue(object.frame, object.timer, BubbleShield_frameTable)64object.state++65// [FallThrough]66case BUBBLESHIELD_IDLE67object.animationTimer++68if object.animationTimer >= 269object.animationTimer = 070object.timer++71if object.timer >= 5472object.timer = 073end if74GetTableValue(object.frame, object.timer, BubbleShield_frameTable)75end if76break7778case BUBBLESHIELD_BOUNCE_SETUP79object.animationTimer = 080object.timer = 081object.frame = 082object.state++83// [FallThrough]84case BUBBLESHIELD_BOUNCE85if object.timer == 086object.animationTimer++87if object.animationTimer >= 588object.frame = 889object.animationTimer = 090object.timer++91end if92else93object.animationTimer++94if object.animationTimer >= 1995object.state = BUBBLESHIELD_IDLE_SETUP96end if97end if98break99100case BUBBLESHIELD_RECOIL_SETUP101object.animationTimer = 0102object.timer = 0103object.frame = 7104object.state++105// [FallThrough]106case BUBBLESHIELD_RECOIL107if object.timer == 0108object.animationTimer++109if object.animationTimer >= 13110object.frame = 8111object.animationTimer = 0112object.timer++113end if114else115object.animationTimer++116if object.animationTimer >= 7117object.state = BUBBLESHIELD_IDLE_SETUP118end if119end if120break121122end switch123end event124125126event ObjectDraw127if Player_superState != SUPERSTATE_SUPER128object.direction = FACING_RIGHT129if object.timer >= 30130if object.frame > 1131object.direction = FLIP_Y132end if133end if134135// Draw at the player's position136DrawSpriteFX(object.frame, FX_FLIP, player[-playerCount].xpos, player[-playerCount].ypos)137end if138end event139140141event ObjectStartup142LoadSpriteSheet("Global/Items3.gif")143144// Bubble shield frames145SpriteFrame(-24, -24, 48, 48, 1, 1)146SpriteFrame(-24, -24, 48, 48, 50, 1)147SpriteFrame(-16, -23, 32, 7, 99, 1)148SpriteFrame(-20, -22, 40, 12, 99, 9)149SpriteFrame(-22, -22, 44, 20, 99, 22)150SpriteFrame(-23, -20, 46, 19, 144, 1)151SpriteFrame(-23, -15, 46, 30, 144, 21)152SpriteFrame(-36, -16, 72, 32, 1, 50)153SpriteFrame(-28, -20, 56, 40, 74, 50)154SpriteFrame(0, 0, 1, 1, 1, 1) // (Empty)155end event156157158// ========================159// Editor Events160// ========================161162event RSDKDraw163DrawSprite(0)164end event165166167event RSDKLoad168LoadSpriteSheet("Global/Display.gif")169SpriteFrame(-16, -16, 32, 32, 1, 143)170171SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")172end event173174175