Path: blob/main/Scripts/Mission/PohBee2.txt
1319 views
//------------------Sonic CD PohBee 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.XOriginPos8#alias Object.Value2 : Object.CurrentFrame9#alias Object.Value3 : Object.ShootingCooldown10#alias Object.Value4 : Object.FrameIncrease1112#alias Object.PropertyValue : Object.Quality1314// PohBee Bullet Aliases15#alias Object.Direction : PohBeeBullet.Direction16#alias Object.XPos : PohBeeBullet.XPos17#alias Object.YPos : PohBeeBullet.YPos18#alias Object.Value1 : PohBeeBullet.XVelocity19#alias Object.Value2 : PohBeeBullet.YVelocity2021// States22#alias 0 : POHBEE2_MOVING_LEFT23#alias 1 : POHBEE2_TURN_RIGHT24#alias 2 : POHBEE2_MOVING_RIGHT25#alias 3 : POHBEE2_TURN_LEFT26#alias 4 : POHBEE2_SHOOTING_LEFT27#alias 5 : POHBEE2_SHOOTING_RIGHT28#alias 6 : POHBEE2_RESET2930// Priority31#alias 0 : PRIORITY_BOUNDS32#alias 1 : PRIORITY_ACTIVE3334// Stage SFX35#alias 7 : SFX_S_SHOT3637// Badnik Quality / Property Values38#alias 0 : GOOD_QUALITY39#alias 1 : BAD_QUALITY40#alias 2 : STATIONARY // This PohBee is also good quality414243sub ObjectMain44if Object.OutOfBounds == true45Object.State = POHBEE2_RESET46Object.Timer = 047Object.Direction = FACING_RIGHT48Object.XPos = Object.XOriginPos49Object.CurrentFrame = 050Object.ShootingCooldown = 051Object.FrameIncrease = 052end if5354if Object.Quality == GOOD_QUALITY55switch Object.State56case POHBEE2_MOVING_LEFT57Object.Priority = PRIORITY_ACTIVE58if Object.ShootingCooldown > 059Object.ShootingCooldown--60end if61if Object.Timer < 25662Object.Timer++63Object.XPos -= 0x2000064else65Object.State = POHBEE2_TURN_RIGHT66Object.Timer = 067end if68break6970case POHBEE2_TURN_RIGHT71Object.Priority = PRIORITY_ACTIVE72if Object.ShootingCooldown > 073Object.ShootingCooldown--74end if75if Object.Timer < 6076if Object.Timer == 3077Object.Direction=FACING_LEFT78end if79Object.Timer++80else81Object.State = POHBEE2_MOVING_RIGHT82end if83break8485case POHBEE2_MOVING_RIGHT86Object.Priority = PRIORITY_ACTIVE87if Object.ShootingCooldown > 088Object.ShootingCooldown--89end if90if Object.Timer < 25691Object.Timer++92Object.XPos += 0x2000093else94Object.State = POHBEE2_TURN_LEFT95Object.Timer = 096end if97break9899case POHBEE2_TURN_LEFT100Object.Priority = PRIORITY_ACTIVE101if Object.ShootingCooldown > 0102Object.ShootingCooldown--103end if104if Object.Timer < 60105if Object.Timer == 30106Object.Direction = FACING_RIGHT107end if108Object.Timer++109else110Object.State = POHBEE2_MOVING_LEFT111end if112break113114case POHBEE2_SHOOTING_LEFT115Object.Priority = PRIORITY_ACTIVE116if Object.ShootingCooldown < 46117Object.ShootingCooldown++118if Object.ShootingCooldown == 15119Object.FrameIncrease = 4120end if121if Object.ShootingCooldown == 32122CreateTempObject(TypeName[Poh Bee Bullet],0,Object.XPos,Object.YPos)123PohBeeBullet[TempObjectPos].XPos -= 0xF0000124PohBeeBullet[TempObjectPos].YPos += 0x1B0000125PohBeeBullet[TempObjectPos].XVelocity = -0x40000126PohBeeBullet[TempObjectPos].YVelocity = 0x40000127PlayStageSfx(SFX_S_SHOT,0)128end if129else130Object.State = POHBEE2_MOVING_LEFT131Object.FrameIncrease = 0132Object.ShootingCooldown = 30133end if134break135136case POHBEE2_SHOOTING_RIGHT137Object.Priority = PRIORITY_ACTIVE138if Object.ShootingCooldown < 46139Object.ShootingCooldown++140if Object.ShootingCooldown == 15141Object.FrameIncrease = 4142end if143if Object.ShootingCooldown == 32144CreateTempObject(TypeName[Poh Bee Bullet],0,Object.XPos,Object.YPos)145PohBeeBullet[TempObjectPos].Direction = FACING_LEFT146PohBeeBullet[TempObjectPos].XPos += 0xF0000147PohBeeBullet[TempObjectPos].YPos += 0x1B0000148PohBeeBullet[TempObjectPos].XVelocity = 0x40000149PohBeeBullet[TempObjectPos].YVelocity = 0x40000150PlayStageSfx(SFX_S_SHOT,0)151end if152else153Object.State = POHBEE2_MOVING_RIGHT154Object.FrameIncrease = 0155Object.ShootingCooldown = 30156end if157break158159case POHBEE2_RESET160if Object.OutOfBounds == true161Object.State = POHBEE2_MOVING_LEFT162Object.Priority = PRIORITY_BOUNDS163end if164break165166end switch167else168switch Object.State169case POHBEE2_MOVING_LEFT170Object.Priority = PRIORITY_ACTIVE171if Object.Timer < 256172Object.Timer++173Object.XPos -= 0x10000174else175Object.State = POHBEE2_TURN_RIGHT176Object.Timer = 0177end if178break179180case POHBEE2_TURN_RIGHT181Object.Priority = PRIORITY_ACTIVE182if Object.Timer < 30183if Object.Timer == 15184Object.Direction = FACING_LEFT185end if186Object.Timer++187else188Object.State = POHBEE2_MOVING_RIGHT189end if190break191192193case POHBEE2_MOVING_RIGHT194Object.Priority = PRIORITY_ACTIVE195if Object.Timer < 512196Object.Timer++197Object.XPos += 0x10000198else199Object.State = POHBEE2_TURN_LEFT200Object.Timer = 0201end if202break203204case POHBEE2_TURN_LEFT205Object.Priority = PRIORITY_ACTIVE206if Object.Timer < 30207if Object.Timer == 15208Object.Direction = FACING_RIGHT209end if210Object.Timer++211else212Object.State = POHBEE2_MOVING_LEFT213end if214break215216case POHBEE2_RESET217if Object.OutOfBounds == true218Object.State = POHBEE2_MOVING_LEFT219Object.Priority = PRIORITY_BOUNDS220end if221break222end switch223end if224225CallFunction(StageSetup_CheckGoodFuture)226end sub227228229sub ObjectPlayerInteraction230if Object.Quality == GOOD_QUALITY231if Object.State < POHBEE2_SHOOTING_LEFT232if Object.ShootingCooldown == 0233PlayerObjectCollision(C_TOUCH, -96, -64, 96, 64)234if CheckResult == true235if Object.XPos > Player.XPos236Object.Direction = FACING_RIGHT237Object.State = POHBEE2_SHOOTING_LEFT238else239Object.Direction = FACING_LEFT240Object.State = POHBEE2_SHOOTING_RIGHT241end if242end if243end if244end if245end if246247if Object.State < POHBEE2_RESET248PlayerObjectCollision(C_ENEMY, -20, -16, 20, 14)249if CheckResult == true250CallFunction(Player_BadnikBreak)251end if252end if253end sub254255256sub ObjectDraw257if Object.State < POHBEE2_RESET258if Object.Quality == GOOD_QUALITY259Object.CurrentFrame++260Object.CurrentFrame &= 3261262Object.Frame = Object.CurrentFrame263Object.Frame >>= 1264Object.Frame += Object.FrameIncrease265else266Object.CurrentFrame++267Object.CurrentFrame &= 3268269Object.Frame = Object.CurrentFrame270Object.Frame >>= 1271Object.Frame += 2272end if273DrawSpriteFX(Object.Frame, FX_FLIP, Object.XPos, Object.YPos)274end if275end sub276277278sub ObjectStartup279LoadSpriteSheet("R6/Objects.gif")280// Good281SpriteFrame(-24, -20, 48, 32, 148, 75) // #0 - PohBee Fly frame 0282SpriteFrame(-24, -16, 48, 28, 148, 108) // #1 - PohBee Fly frame 1283// Bad284SpriteFrame(-24, -20, 48, 32, 99, 133) // #2 - PohBee Fly frame 0285SpriteFrame(-24, -16, 48, 28, 148, 137) // #3 - PohBee Fly frame 1286// Shooting287SpriteFrame(-24, -20, 48, 40, 197, 91) // #4 - PohBee Shoot frame 0288SpriteFrame(-24, -16, 48, 36, 197, 132) // #5 - PohBee Shoot frame 1289290ArrayPos0 = 32291while ArrayPos0 < 1056292if Object[ArrayPos0].Type == TypeName[Poh Bee]293Object[ArrayPos0].Type = TypeName[PohBee2]294end if295if Object[ArrayPos0].Type == TypeName[PohBee2]296Object[ArrayPos0].XOriginPos = Object[ArrayPos0].XPos297end if298ArrayPos0++299loop300end sub301302303// ========================304// Editor Subs305// ========================306307sub RSDKEdit308if Editor.ReturnVariable == true309switch Editor.VariableID310case EDIT_VAR_PROPVAL // Property Value311CheckResult = Object.PropertyValue312break313case 0 // Condition314CheckResult = Object.PropertyValue315break316end switch317else318switch Editor.VariableID319case EDIT_VAR_PROPVAL // Property Value320Object.PropertyValue = Editor.VariableValue321break322case 0 // Condition323Object.PropertyValue = Editor.VariableValue324break325end switch326end if327end sub328329330sub RSDKDraw331DrawSprite(Object.PropertyValue)332end sub333334335sub RSDKLoad336LoadSpriteSheet("R6/Objects.gif")337// Good338SpriteFrame(-24, -20, 48, 32, 148, 75) // #0 - PohBee Fly339// Bad340SpriteFrame(-24, -20, 48, 32, 99, 133) // #2 - PohBee Fly341342AddEditorVariable("Condition")343SetActiveVariable("Condition")344AddEnumVariable("Good", GOOD_QUALITY)345AddEnumVariable("Bad", BAD_QUALITY)346AddEnumVariable("Good, Stationary", STATIONARY)347end sub348349350351352