Path: blob/main/Scripts/R4/AirBubble.txt
1319 views
//-----------------Sonic CD Air Bubble 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.Angle7#alias Object.Value2 : Object.XVelocity8#alias Object.Value3 : Object.YVelocity910#alias Player.Value14 : Player.DropDashCharge1112// States13#alias 0 : AIRBUBBLE_ACTIVE14#alias 1 : AIRBUBBLE_USED1516// Stage SFX17#alias 6 : SFX_S_BREATHING1819// Air Bubble Property Values20#alias 2 : BUBBLE_SMALL21#alias 4 : BUBBLE_MEDIUM22#alias 5 : BUBBLE_BREATHABLE23#alias 6 : BUBBLE_EXPLODE242526sub ObjectMain27if Object.State == AIRBUBBLE_ACTIVE28Object.Timer++29if Object.Timer > 1530Object.Timer = 031if Object.Frame == 632Object.Type = TypeName[Blank Object]33end if34// Property value determines the max size of the bubble35if Object.Frame < Object.PropertyValue36Object.Frame++37end if38end if3940Object.YPos += Object.YVelocity4142// Small bubbles fly away while sonic is pushed by water streams43if Player.Animation == ANI_FANROTATE44if Object.PropertyValue < 345Object.XVelocity += 0x4000046end if47end if48if Player.Animation == ANI_CLINGING49if Object.PropertyValue < 350Object.XVelocity += 0x4000051end if52end if5354if Object.Frame < 655Sin(Object.XPos, Object.Angle)56Object.XPos <<= 957Object.XPos += Object.XVelocity5859Object.Angle += 460Object.Angle &= 51161end if6263if Object.iYPos < Stage.WaterLevel64if Object.PropertyValue == BUBBLE_BREATHABLE65Object.Frame = 666Object.PropertyValue = BUBBLE_EXPLODE67Object.Timer = 068Object.YVelocity = 069else70// Despawn small and medium bubbles above water level71if Object.PropertyValue < 572Object.Type = TypeName[Blank Object]73end if74end if75end if7677else78if Object.Timer < 2079Object.Timer++80Player.Animation = ANI_BREATHING81else82Object.Type = TypeName[Blank Object]8384Player.Animation = ANI_WALKING85Player.AnimationSpeed = 208687#platform: Use_Origins88if Player.State == Player_State_GlideRight89Player.Animation = ANI_GLIDING90end if91if Player.State == Player_State_GlideLeft92Player.Animation = ANI_GLIDING93end if9495if Player.DropDashCharge >= 2096Player.PrevAnimation = ANI_WALKING97Player.AnimationSpeed = 20098end if99#endplatform100end if101end if102103if Object.OutOfBounds == true104Object.Type = TypeName[Blank Object]105end if106end sub107108109sub ObjectPlayerInteraction110if Object.Frame == 5111PlayerObjectCollision(C_TOUCH, -4, -4, 4, 4)112if CheckResult == true113Object.Frame = 6114Object.State = AIRBUBBLE_USED115Object.Timer = 0116Object.YVelocity = 0117118Player.YVelocity = 0119Player.XVelocity = 0120Player.Speed = 0121Player.Animation = ANI_BREATHING122Player.AirTimer = 0123PlayStageSfx(SFX_S_BREATHING, false)124end if125end if126end sub127128129sub ObjectDraw130DrawSprite(Object.Frame)131end sub132133134sub ObjectStartup135LoadSpriteSheet("R4/Objects.gif")136137SpriteFrame(-4, -4, 8, 8, 212, 61) // #0 - Small Bubble138SpriteFrame(-4, -4, 8, 8, 212, 70) // #1 - Small Bubble 2139SpriteFrame(-4, -4, 8, 8, 246, 18) // #2 - Small Bubble 3140SpriteFrame(-8, -8, 16, 16, 116, 181) // #3 - Medium Bubble141SpriteFrame(-8, -8, 16, 16, 116, 198) // #4 - Medium Bubble 2142SpriteFrame(-16, -16, 32, 32, 148, 194) // #5 - Big Bubble143SpriteFrame(-16, -16, 32, 32, 181, 201) // #6 - Big Bubble 2144end sub145146147// ========================148// Editor Subs149// ========================150151sub RSDKDraw152DrawSprite(0)153end sub154155156sub RSDKLoad157LoadSpriteSheet("R4/Objects.gif")158SpriteFrame(-16, -16, 32, 32, 148, 194) // #5 - Big Bubble159160SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")161end sub162163164