Path: blob/master/Sonic 2/Scripts/Global/BubbleShield.txt
1483 views
// ----------------------------------1// RSDK Project: Sonic 22// 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_PLAYER2122// Player aliases23private alias object.state : player.state24private alias object.xpos : player.xpos25private alias object.ypos : player.ypos2627private 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_PLAYER5758switch object.state59case BUBBLESHIELD_IDLE_SETUP60object.animationTimer = 061object.timer = 062GetTableValue(object.frame, object.timer, BubbleShield_frameTable)63object.state++64// [FallThrough]65case BUBBLESHIELD_IDLE66object.animationTimer++67if object.animationTimer >= 268object.animationTimer = 069object.timer++70if object.timer >= 5471object.timer = 072end if73GetTableValue(object.frame, object.timer, BubbleShield_frameTable)74end if75break7677case BUBBLESHIELD_BOUNCE_SETUP78object.animationTimer = 079object.timer = 080object.frame = 081object.state++82// [FallThrough]83case BUBBLESHIELD_BOUNCE84if object.timer == 085object.animationTimer++86if object.animationTimer >= 587object.frame = 888object.animationTimer = 089object.timer++90end if91else92object.animationTimer++93if object.animationTimer >= 1994object.state = BUBBLESHIELD_IDLE_SETUP95end if96end if97break9899case BUBBLESHIELD_RECOIL_SETUP100object.animationTimer = 0101object.timer = 0102object.frame = 7103object.state++104// [FallThrough]105case BUBBLESHIELD_RECOIL106if object.timer == 0107object.animationTimer++108if object.animationTimer >= 13109object.frame = 8110object.animationTimer = 0111object.timer++112end if113else114object.animationTimer++115if object.animationTimer >= 7116object.state = BUBBLESHIELD_IDLE_SETUP117end if118end if119break120121end switch122end event123124125event ObjectDraw126if Player_superState != SUPERSTATE_SUPER127object.direction = FLIP_NONE128if object.timer >= 30129if object.frame > 1130object.direction = FLIP_Y131end if132end if133134// Draw at the player's position135DrawSpriteFX(object.frame, FX_FLIP, player[-playerCount].xpos, player[-playerCount].ypos)136end if137end event138139140event ObjectStartup141LoadSpriteSheet("Global/Items3.gif")142143// Bubble shield frames144SpriteFrame(-24, -24, 48, 48, 1, 1)145SpriteFrame(-24, -24, 48, 48, 50, 1)146SpriteFrame(-16, -23, 32, 7, 99, 1)147SpriteFrame(-20, -22, 40, 12, 99, 9)148SpriteFrame(-22, -22, 44, 20, 99, 22)149SpriteFrame(-23, -20, 46, 19, 144, 1)150SpriteFrame(-23, -15, 46, 30, 144, 21)151SpriteFrame(-36, -16, 72, 32, 1, 50)152SpriteFrame(-28, -20, 56, 40, 74, 50)153SpriteFrame(0, 0, 1, 1, 1, 1) // (Empty)154end event155156157// ========================158// Editor Events159// ========================160161event RSDKDraw162DrawSprite(0)163end event164165166event RSDKLoad167LoadSpriteSheet("Global/Display.gif")168SpriteFrame(-16, -16, 32, 32, 1, 143)169170SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")171end event172173174