Path: blob/main/Scripts/R4/Eggman2.txt
1319 views
//-----------------Sonic CD Egg 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.BubbleSpawnTimer7#alias Object.Value2 : Object.BubbleSelector8#alias Object.Value3 : Object.BubbleRadius9#alias Object.Value4 : Object.MaxBubble10#alias Object.Value5 : Object.Angle11#alias Object.Value6 : Object.BubbleOffset12#alias Object.Value7 : Object.Animation13#alias Object.Frame : Object.FrameTimer141516// Boss Bubble 1 Aliases17#alias Object.Value2 : Bubble1.XOffSet18#alias Object.Value4 : Bubble1.XShift19#alias Object.Value5 : Bubble1.BossEntity20#alias Object.Value6 : Bubble1.RadiusSize21#alias Object.XPos : Bubble1.XPos22#alias Object.YPos : Bubble1.YPos2324// Boss Bubble 2 aliases25#alias Object.Value0 : Bubble2.Timer26#alias Object.Value2 : Bubble2.XOffSet27#alias Object.Value3 : Bubble2.YOffSet28#alias Object.Value4 : Bubble2.XShift29#alias Object.Value5 : Bubble2.BossEntity30#alias Object.Value6 : Bubble2.RadiusSize31#alias Object.XPos : Bubble2.XPos32#alias Object.YPos : Bubble2.YPos33#alias Object.State : Bubble2.State34#alias Object.DrawOrder : Bubble2.DrawOrder35#alias Object.Type : Bubble2.Type3637// Boss Bullet alias38#alias Object.DrawOrder : Bullet.DrawOrder39#alias Object.Value5 : Bullet.BossEntity4041// Object +17 is a helper object for the boss movement42#alias Object[+17].XPos : Helper.XPos43#alias Object[+17].YPos : Helper.YPos44#alias Object[+17].Value5 : Helper.Angle4546// Player alias47#alias Player.Value4 : Player.InvincibleTimer4849// States50#alias 0 : R4_EGG_BUBBLE_PLAYER_APPROACH51#alias 1 : R4_EGG_BUBBLE_INTRO52#alias 2 : R4_EGG_BUBBLE_SPAWN_BUBBLES53#alias 3 : R4_EGG_BUBBLE_DELAY54#alias 4 : R4_EGG_BUBBLE_EXPAND_SHIELD55#alias 5 : R4_EGG_BUBBLE_START_BATTLE56#alias 6 : R4_EGG_BUBBLE_ATTACK_R_TO_L57#alias 7 : R4_EGG_BUBBLE_TURN_TO_RIGHT58#alias 8 : R4_EGG_BUBBLE_ATTACK_L_TO_R59#alias 9 : R4_EGG_BUBBLE_TURN_TO_LEFT60#alias 10 : R4_EGG_BUBBLE_REBUILD_SHIELD_L61#alias 11 : R4_EGG_BUBBLE_MOVE_TO_R62#alias 12 : R4_EGG_BUBBLE_REBUILD_SHIELD_R63#alias 13 : R4_EGG_BUBBLE_MOVE_TO_L64#alias 14 : R4_EGG_BUBBLE_EXPLODE65#alias 15 : R4_EGG_BUBBLE_DEFEAT66#alias 16 : R4_EGG_BUBBLE_FLEE67#alias 17 : R4_EGG_BUBBLE_RESTORE_BOUNDS6869// BossBubble2 States70#alias 2 : BOSSBUBBLE2_BREATHABLE71#alias 3 : BOSSBUBBLE2_CONSUMED7273// Eggman Animations74#alias 0 : EGGANI_IDLE75#alias 1 : EGGANI_LAUGH76#alias 2 : EGGANI_HURT77#alias 3 : EGGANI_DEFEAT78#alias 4 : EGGANI_ESCAPE79#alias 5 : EGGANI_NONE8081// Fade Music Property Values82#alias 0 : FADEMUSIC_TO_BOSS83#alias 1 : FADEMUSIC_TO_LEVEL8485// Global SFX86#alias 22 : SFX_G_EXPLOSION8788// Stage SFX89#alias 7 : SFX_S_DROWNING9091// Priority92#alias 0 : PRIORITY_BOUNDS93#alias 1 : PRIORITY_ACTIVE9495// Function declarations96#function EggBubble_HandleBubbleMovement97#function EggBubble_HandleBubbleTurn98#function EggBubble_CheckShieldCondition99#function EggBubble_CheckBubbleAmount100#function EggBubble_DestroyBubbles101#function EggBubble_FireBullet102103104function EggBubble_HandleBubbleMovement105ArrayPos0 = 1106TempValue0 = Object.Angle107while ArrayPos0 <= Object.MaxBubble108if Bubble2[+ArrayPos0].State < 3109Bubble2[+ArrayPos0].DrawOrder = 3110// Orbit-like movement111Cos(TempValue1, TempValue0)112TempValue1 *= Object.BubbleRadius113TempValue1 >>= 1114// Horizontal movement115Cos(Bubble2[+ArrayPos0].XPos, Object.Rotation)116Bubble2[+ArrayPos0].XPos *= TempValue1117Bubble2[+ArrayPos0].XPos >>= 9118Bubble2[+ArrayPos0].XPos += Object.XPos119// Vertical movement120Sin(Bubble2[+ArrayPos0].YPos, TempValue0)121Bubble2[+ArrayPos0].YPos *= Object.BubbleRadius122Bubble2[+ArrayPos0].YPos >>= 1123Bubble2[+ArrayPos0].YPos += Object.YPos124end if125TempValue0 += Object.BubbleOffset126ArrayPos0++127loop128end function129130131function EggBubble_HandleBubbleTurn132ArrayPos0 = 1133TempValue0 = Object.Angle134while ArrayPos0 <= Object.MaxBubble135if Bubble2[+ArrayPos0].State < 3136if TempValue0 < 128137Bubble2[+ArrayPos0].DrawOrder = 3138else139if TempValue0 > 383140Bubble2[+ArrayPos0].DrawOrder = 3141else142Bubble2[+ArrayPos0].DrawOrder = 2143end if144end if145// Orbit-like movement146Cos(TempValue1, TempValue0)147TempValue1 *= Object.BubbleRadius148TempValue1 >>= 1149// Horizontal movement150Cos(Bubble2[+ArrayPos0].XPos, Object.Rotation)151Bubble2[+ArrayPos0].XPos *= TempValue1152Bubble2[+ArrayPos0].XPos >>= 9153Bubble2[+ArrayPos0].XPos += Object.XPos154// Vertical movement155Sin(Bubble2[+ArrayPos0].YPos, TempValue0)156Bubble2[+ArrayPos0].YPos *= Object.BubbleRadius157Bubble2[+ArrayPos0].YPos >>= 1158Bubble2[+ArrayPos0].YPos += Object.YPos159end if160TempValue0 += Object.BubbleOffset161TempValue0 &= 511162ArrayPos0++163loop164end function165166167function EggBubble_CheckShieldCondition168ArrayPos0 = 1169TempValue0 = 0170while ArrayPos0 <= Object.MaxBubble171if Bubble2[+ArrayPos0].Type == TypeName[Boss Bubble 2]172TempValue0++173end if174ArrayPos0++175loop176177CheckResult = false178switch TempValue0179case 3180if Object.MaxBubble > 4181CheckResult = true182end if183break184185case 4186case 5187case 6188case 7189if TempValue0 < Object.MaxBubble190CheckResult = true191end if192break193194case 8195case 9196case 10197case 11198case 12199case 13200case 14201TempValue1 = Object.MaxBubble202TempValue1 -= TempValue0203if TempValue1 > 1204CheckResult = true205end if206break207208end switch209end function210211212function EggBubble_CheckBubbleAmount213ArrayPos0 = 1214TempValue0 = 0215while ArrayPos0 <= Object.MaxBubble216if Bubble2[+ArrayPos0].Type == TypeName[Boss Bubble 2]217TempValue0++218end if219ArrayPos0++220loop221222ArrayPos0 = 1223while ArrayPos0 <= Object.MaxBubble224if ArrayPos0 <= TempValue0225Bubble2[+ArrayPos0].Type = TypeName[Boss Bubble 2]226Bubble2[+ArrayPos0].State = BOSSBUBBLE2_BREATHABLE227Bubble2[+ArrayPos0].TImer = 0228else229Bubble2[+ArrayPos0].Type = TypeName[Blank Object]230end if231ArrayPos0++232loop233234Object.MaxBubble = TempValue0235Object.BubbleOffset = 512236Object.BubbleOffset /= Object.MaxBubble237end function238239240function EggBubble_DestroyBubbles241ArrayPos0 = 1242while ArrayPos0 <= Object.MaxBubble243if Bubble2[+ArrayPos0].Type == TypeName[Boss Bubble 2]244Bubble2[+ArrayPos0].State = BOSSBUBBLE2_CONSUMED245Bubble2[+ArrayPos0].TImer = 0246end if247ArrayPos0++248loop249end function250251252function EggBubble_FireBullet253if Object.Direction == FACING_RIGHT254CreateTempObject(TypeName[Boss Bullet], 0, Object.XPos, Object.YPos)255Bullet[TempObjectPos].BossEntity = Object.EntityNo256Bullet[TempObjectPos].DrawOrder = 2257CreateTempObject(TypeName[Boss Bullet], 1, Object.XPos, Object.YPos)258Bullet[TempObjectPos].BossEntity = Object.EntityNo259Bullet[TempObjectPos].DrawOrder = 2260CreateTempObject(TypeName[Boss Bullet], 2, Object.XPos, Object.YPos)261Bullet[TempObjectPos].BossEntity = Object.EntityNo262Bullet[TempObjectPos].DrawOrder = 2263CreateTempObject(TypeName[Boss Bullet], 3, Object.XPos, Object.YPos)264Bullet[TempObjectPos].BossEntity = Object.EntityNo265Bullet[TempObjectPos].DrawOrder = 2266else267CreateTempObject(TypeName[Boss Bullet], 4, Object.XPos, Object.YPos)268Bullet[TempObjectPos].BossEntity = Object.EntityNo269Bullet[TempObjectPos].DrawOrder = 2270CreateTempObject(TypeName[Boss Bullet], 5, Object.XPos, Object.YPos)271Bullet[TempObjectPos].BossEntity = Object.EntityNo272Bullet[TempObjectPos].DrawOrder = 2273CreateTempObject(TypeName[Boss Bullet], 6, Object.XPos, Object.YPos)274Bullet[TempObjectPos].BossEntity = Object.EntityNo275Bullet[TempObjectPos].DrawOrder = 2276CreateTempObject(TypeName[Boss Bullet], 7, Object.XPos, Object.YPos)277Bullet[TempObjectPos].BossEntity = Object.EntityNo278Bullet[TempObjectPos].DrawOrder = 2279end if280end function281282283sub ObjectMain284switch Object.State285case R4_EGG_BUBBLE_PLAYER_APPROACH286Stage.NewXBoundary1 = Object.iXPos287Stage.NewXBoundary1 -= 96288Stage.NewXBoundary1 -= Screen.CenterX289290Stage.NewXBoundary2 = Stage.NewXBoundary1291Stage.NewXBoundary2 += Screen.CenterX292Stage.NewXBoundary2 += Screen.CenterX293294PlayerObjectCollision(C_TOUCH, -80, -256, 64, 256)295if CheckResult == true296Object.State = R4_EGG_BUBBLE_INTRO297298Helper.XPos = Object.XPos299Helper.XPos -= 0x600000300301Helper.YPos = Object.YPos302303CreateTempObject(TypeName[Fade Music], FADEMUSIC_TO_BOSS, Object.XPos, Object.YPos)304end if305break306307case R4_EGG_BUBBLE_INTRO308if Object.Timer < 60309Object.Timer++310else311Object.Timer = 0312Object.BubbleSelector = 0313314Object.State = R4_EGG_BUBBLE_SPAWN_BUBBLES315end if316break317318case R4_EGG_BUBBLE_SPAWN_BUBBLES319if Object.Timer < 320320TempValue0 = Object.Timer321TempValue0 %= 20322if TempValue0 == 0323PlayStageSfx(SFX_S_DROWNING, false)324end if325326if Object.BubbleSpawnTimer > 0327Object.BubbleSpawnTimer--328else329Object.BubbleSpawnTimer = 10330331CreateTempObject(TypeName[Boss Bubble 1], 0, Object.XPos, Object.YPos)332333Rand(Bubble1[TempObjectPos].XPos, 28)334Bubble1[TempObjectPos].XPos -= 14335Bubble1[TempObjectPos].XPos <<= 16336Bubble1[TempObjectPos].XPos += Object.XPos337338Bubble1[TempObjectPos].XOffSet = Bubble1[TempObjectPos].XPos339340Bubble1[TempObjectPos].YPos += 0x9C0000341342Rand(Bubble1[TempObjectPos].XShift, 4)343Bubble1[TempObjectPos].XShift += 9344345Bubble1[TempObjectPos].BossEntity = Object.EntityNo346347if Object.BubbleSelector == 1348Rand(Bubble1[TempObjectPos].RadiusSize, 32)349Bubble1[TempObjectPos].RadiusSize -= 16350Bubble1[TempObjectPos].RadiusSize <<= 16351else352Bubble1[TempObjectPos].RadiusSize = 0353end if354Object.BubbleSelector++355Object.BubbleSelector &= 1356end if357358Object.Timer++359else360Object.State = R4_EGG_BUBBLE_DELAY361Object.Timer = 0362end if363break364365case R4_EGG_BUBBLE_DELAY366if Object.Timer < 180367Object.Timer++368else369Object.Timer = 0370Object.Angle = 0371Object.Rotation = 256372373Object.MaxBubble = 16374Object.BubbleOffset = 32375Object.BubbleRadius = 0x1000376377Object.State = R4_EGG_BUBBLE_EXPAND_SHIELD378ArrayPos0 = 1379while ArrayPos0 < 17380Bubble2[+ArrayPos0].Type = TypeName[Boss Bubble 2]381ArrayPos0++382loop383CallFunction(EggBubble_HandleBubbleMovement)384end if385break386387case R4_EGG_BUBBLE_EXPAND_SHIELD388Object.Angle += 8389Object.Angle &= 511390391if Object.BubbleRadius < 0x3000392Object.BubbleRadius += 0x60393else394Object.State = R4_EGG_BUBBLE_START_BATTLE395end if396397CallFunction(EggBubble_HandleBubbleMovement)398break399400case R4_EGG_BUBBLE_START_BATTLE401Object.Angle += 2402Object.Angle &= 511403404if Object.Timer < 20405Object.Timer++406else407Object.State = R4_EGG_BUBBLE_ATTACK_R_TO_L408Helper.Angle = 0409end if410411CallFunction(EggBubble_HandleBubbleMovement)412break413414case R4_EGG_BUBBLE_ATTACK_R_TO_L415Cos(Object.XPos, Helper.Angle)416Object.XPos *= 0x3000417Object.XPos += Helper.XPos418419Sin(Object.YPos, Helper.Angle)420Object.YPos *= 0x2000421Object.YPos += Helper.YPos422423if Helper.Angle == 12424CallFunction(EggBubble_FireBullet)425end if426427if Helper.Angle < 256428Helper.Angle += 2429else430Object.State = R4_EGG_BUBBLE_TURN_TO_RIGHT431end if432433Object.Angle += 2434Object.Angle &= 511435CallFunction(EggBubble_HandleBubbleMovement)436break437438case R4_EGG_BUBBLE_TURN_TO_RIGHT439Object.Angle += 8440Object.Angle &= 511441442CallFunction(EggBubble_HandleBubbleTurn)443444if Object.Rotation == 128445Object.Direction = FACING_LEFT446end if447448if Object.Rotation > 0449Object.Rotation -= 2450else451CallFunction(EggBubble_CheckShieldCondition)452if CheckResult == true453Object.State = R4_EGG_BUBBLE_REBUILD_SHIELD_L454Object.Timer = 0455else456Object.State = R4_EGG_BUBBLE_ATTACK_L_TO_R457end if458end if459460break461462case R4_EGG_BUBBLE_ATTACK_L_TO_R463Cos(Object.XPos, Helper.Angle)464Object.XPos *= 0x3000465Object.XPos += Helper.XPos466467Sin(Object.YPos, Helper.Angle)468Object.YPos *= 0x2000469Object.YPos += Helper.YPos470471if Helper.Angle == 244472CallFunction(EggBubble_FireBullet)473end if474if Helper.Angle > 0475Helper.Angle -= 2476else477Object.State = R4_EGG_BUBBLE_TURN_TO_LEFT478end if479480Object.Angle += 2481Object.Angle &= 511482CallFunction(EggBubble_HandleBubbleMovement)483break484485case R4_EGG_BUBBLE_TURN_TO_LEFT486Object.Angle += 8487Object.Angle &= 511488CallFunction(EggBubble_HandleBubbleTurn)489490if Object.Rotation == 128491Object.Direction = FACING_RIGHT492end if493if Object.Rotation < 256494Object.Rotation += 2495else496CallFunction(EggBubble_CheckShieldCondition)497if CheckResult == true498Object.State = R4_EGG_BUBBLE_REBUILD_SHIELD_R499Object.Timer = 0500else501Object.State = R4_EGG_BUBBLE_ATTACK_R_TO_L502end if503end if504break505506case R4_EGG_BUBBLE_REBUILD_SHIELD_L507Object.XPos += 0x10000508509if Object.Timer < 20510Object.Timer++511512Object.Angle += 2513Object.Angle &= 511514CallFunction(EggBubble_HandleBubbleMovement)515516if Object.Timer == 20517Object.Animation = EGGANI_LAUGH518end if519else520if Object.BubbleRadius > 0xC00521Object.BubbleRadius -= 0x100522else523Object.State = R4_EGG_BUBBLE_MOVE_TO_R524CallFunction(EggBubble_CheckBubbleAmount)525CallFunction(EggBubble_FireBullet)526end if527528Object.Angle += 8529Object.Angle &= 511530CallFunction(EggBubble_HandleBubbleMovement)531end if532break533534case R4_EGG_BUBBLE_MOVE_TO_R535Object.XPos += 0x10000536537if Object.BubbleRadius < 0x3000538Object.BubbleRadius += 0x60539Object.Angle += 8540else541Object.Angle += 2542end if543544TempValue0 = Helper.XPos545TempValue0 += 0x600000546547if Object.XPos > TempValue0548Object.XPos = TempValue0549Helper.Angle = 0550Object.State = R4_EGG_BUBBLE_TURN_TO_LEFT551end if552553Object.Angle &= 511554CallFunction(EggBubble_HandleBubbleMovement)555break556557case R4_EGG_BUBBLE_REBUILD_SHIELD_R558Object.XPos -= 0x10000559560if Object.Timer < 20561Object.Timer++562563Object.Angle += 2564Object.Angle &= 511565CallFunction(EggBubble_HandleBubbleMovement)566567if Object.Timer == 20568Object.Animation = EGGANI_LAUGH569end if570else571if Object.BubbleRadius > 0xC00572Object.BubbleRadius -= 0x100573else574Object.State = R4_EGG_BUBBLE_MOVE_TO_L575CallFunction(EggBubble_CheckBubbleAmount)576CallFunction(EggBubble_FireBullet)577end if578579Object.Angle += 8580Object.Angle &= 511581CallFunction(EggBubble_HandleBubbleMovement)582end if583break584585case R4_EGG_BUBBLE_MOVE_TO_L586Object.XPos -= 0x10000587588if Object.BubbleRadius < 0x3000589Object.BubbleRadius += 0x60590Object.Angle += 8591else592Object.Angle += 2593end if594595TempValue0 = Helper.XPos596TempValue0 -= 0x600000597598if Object.XPos < TempValue0599Object.XPos = TempValue0600Helper.Angle = 256601Object.State = R4_EGG_BUBBLE_TURN_TO_RIGHT602end if603604Object.Angle &= 511605CallFunction(EggBubble_HandleBubbleMovement)606break607608case R4_EGG_BUBBLE_EXPLODE609if Object.Timer < 70610TempValue0 = Object.Timer611TempValue0 &= 3612if TempValue0 == 0613Rand(TempValue0, 80)614TempValue0 -= 40615TempValue0 <<= 16616TempValue0 += Object.XPos617618Rand(TempValue1, 56)619TempValue1 -= 28620TempValue1 <<= 16621TempValue1 += Object.YPos622623CreateTempObject(TypeName[Explosion], 0, TempValue0, TempValue1)624PlaySfx(SFX_G_EXPLOSION, false)625end if626Object.Timer++627else628Object.State = R4_EGG_BUBBLE_DEFEAT629Object.Animation = EGGANI_DEFEAT630Object.Timer = 0631Object.Direction = FACING_LEFT632633CallFunction(EggBubble_DestroyBubbles)634635Player.Score += 1000636end if637break638639case R4_EGG_BUBBLE_DEFEAT640if Object.Timer < 70641Object.Timer++642else643Object.Timer = 0644Object.Priority = PRIORITY_ACTIVE645646Object.State = R4_EGG_BUBBLE_FLEE647Object.Animation = EGGANI_ESCAPE648Object.FrameTimer = 0649650Stage.NewWaterLevel = 0x8000000 // Y - 2048 in map coords651CreateTempObject(TypeName[Fade Music], FADEMUSIC_TO_LEVEL, Object.XPos, Object.YPos)652end if653break654655case R4_EGG_BUBBLE_FLEE656Object.XPos += 0x1C000657if Object.OutOfBounds == true658Object.State = R4_EGG_BUBBLE_RESTORE_BOUNDS659Object.Animation = EGGANI_NONE660end if661break662663case R4_EGG_BUBBLE_RESTORE_BOUNDS664if Object.Timer < 60665Stage.XBoundary2 += 4666Object.Timer++667else668ResetObjectEntity(Object.EntityNo, TypeName[Blank Object], 0, 0, 0)669Stage.NewXBoundary2 = 3840670end if671break672673end switch674end sub675676677sub ObjectPlayerInteraction678if Object.State > R4_EGG_BUBBLE_EXPAND_SHIELD679if Object.State < R4_EGG_BUBBLE_EXPLODE680#platform: Use_Standalone681PlayerObjectCollision(C_TOUCH, -24, -16, 24, 16)682#endplatform683#platform: Use_Origins684PlayerObjectCollision(C_ENEMY, -24, -16, 24, 16)685#endplatform686if CheckResult == true687CheckEqual(Player.Animation, ANI_JUMPING)688TempValue0 = CheckResult689CheckEqual(Player.Animation, ANI_SPINDASH)690TempValue0 |= CheckResult691#platform: Use_Origins692// making really sure you're the one character that can glide or the one character that has a hammer693if Stage.PlayerListPos == PLAYER_KNUCKLES694CheckEqual(Player.Animation, ANI_GLIDING)695TempValue0 |= CheckResult696CheckEqual(Player.Animation, ANI_GLIDING_STOP)697TempValue0 |= CheckResult698end if699if Stage.PlayerListPos == PLAYER_AMY700CheckEqual(Player.Animation, ANI_HAMMER_JUMP)701TempValue0 |= CheckResult702CheckEqual(Player.Animation, ANI_HAMMER_DASH)703TempValue0 |= CheckResult704end if705#endplatform706707ArrayPos0 = Player.EntityNo708ArrayPos0 += 2709if Object[ArrayPos0].Type == TypeName[Invincibility]710TempValue0 = true711end if712713if TempValue0 == true714715#platform: Use_Origins716EngineCallback(NOTIFY_KILL_BOSS)717// Tell HE2 that the boss fight ended718game.callbackParam0 = true719EngineCallback(NOTIFY_BOSS_END)720if game.playMode == BOOT_PLAYMODE_BOSSRUSH721StopMusic()722end if723#endplatform724FlipSign(Player.XVelocity)725FlipSign(Player.Speed)726Player.XVelocity >>= 1727Player.Speed >>= 1728729Player.YVelocity = Player.YPos730Player.YVelocity -= Object.YPos731Player.YVelocity >>= 3732733#platform: Use_Origins734if Stage.PlayerListPos == PLAYER_KNUCKLES735if Player.Animation == ANI_GLIDING736Player.Animation = ANI_GLIDING_DROP737Player.State = Player_State_GlideDrop738end if739end if740#endplatform741742Object.State = R4_EGG_BUBBLE_EXPLODE743Object.Animation = EGGANI_HURT744Object.Timer = 0745else746if Player.InvincibleTimer == 0747Player.State = Player_State_GotHit748if Player.XPos > Object.XPos749Player.Speed = 0x20000750else751Player.Speed = -0x20000752end if753end if754Object.Animation = EGGANI_LAUGH755end if756end if757end if758end if759760if Object.State < R4_EGG_BUBBLE_RESTORE_BOUNDS761TempValue0 = Player.CollisionRight762TempValue0 <<= 16763TempValue0 += Player.XPos764765TempValue1 = Stage.XBoundary2766TempValue1 <<= 16767768if TempValue0 > TempValue1769Player.XVelocity = 0770Player.Speed = 0771Player.XPos = TempValue1772773TempValue0 = Player.CollisionRight774TempValue0 <<= 16775Player.XPos -= TempValue0776end if777end if778end sub779780781sub ObjectDraw782switch Object.Animation783case EGGANI_IDLE784DrawSpriteFX(0, FX_FLIP, Object.XPos, Object.YPos)785DrawSpriteFX(2, FX_FLIP, Object.XPos, Object.YPos)786break787788case EGGANI_LAUGH789DrawSpriteFX(0, FX_FLIP, Object.XPos, Object.YPos)790791TempValue0 = Object.FrameTimer792TempValue0 &= 15793TempValue0 >>= 3794TempValue0 += 3795DrawSpriteFX(TempValue0, FX_FLIP, Object.XPos, Object.YPos)796797if Object.FrameTimer < 112798Object.FrameTimer++799else800Object.FrameTimer = 0801Object.Animation = 0802end if803break804805case EGGANI_HURT806DrawSpriteFX(0, FX_FLIP, Object.XPos, Object.YPos)807DrawSpriteFX(5, FX_FLIP, Object.XPos, Object.YPos)808break809810case EGGANI_DEFEAT811DrawSpriteFX(1, FX_FLIP, Object.XPos, Object.YPos)812DrawSpriteFX(6, FX_FLIP, Object.XPos, Object.YPos)813break814815case EGGANI_ESCAPE816DrawSpriteFX(1, FX_FLIP, Object.XPos, Object.YPos)817DrawSpriteFX(6, FX_FLIP, Object.XPos, Object.YPos)818819TempValue0 = Object.FrameTimer820TempValue0 >>= 2821TempValue0 += 7822DrawSpriteFX(TempValue0, FX_FLIP, Object.XPos, Object.YPos)823824Object.FrameTimer++825Object.FrameTimer &= 15826break827end switch828end sub829830831sub ObjectStartup832LoadSpriteSheet("R4/Objects2.gif")833834// Egg Mobile835SpriteFrame(-32, -28, 64, 56, 51, 58) // #0 - Egg Bubble2 Battle836SpriteFrame(-32, -28, 64, 56, 189, 58) // #1 - Egg Bubble2 Battle destroyed837838// Eggman839SpriteFrame(-32, -28, 48, 16, 1, 67) // #2 - Eggman face840SpriteFrame(-32, -28, 48, 16, 1, 84) // #3 - Eggman laugh frame 0841SpriteFrame(-32, -28, 48, 16, 1, 101) // #4 - Eggman laugh frame 1842SpriteFrame(-32, -28, 48, 16, 1, 118) // #5 - Eggman hurt843SpriteFrame(-32, -28, 48, 16, 50, 118) // #6 - Eggman defeat844845// Sweat846SpriteFrame(4, -44, 16, 16, 207, 35) // #7 - Sweat drop frame 0847SpriteFrame(4, -44, 1, 1, 207, 35) // #8 - Sweat drop frame 1848SpriteFrame(4, -44, 16, 16, 224, 35) // #9 - Sweat drop frame 2849SpriteFrame(4, -44, 1, 1, 207, 35) // #10 - Sweat drop frame 3850851// Used to be below LoadSpriteSheet, moved here for consistency852ArrayPos0 = 32853while ArrayPos0 < 1056854if Object[ArrayPos0].Type == TypeName[Eggman Part 2]855TempValue0 = 160856TempValue0 -= Screen.CenterX857Object[ArrayPos0].iXPos += TempValue0858end if859ArrayPos0++860loop861end sub862863864// ========================865// Editor Subs866// ========================867868sub RSDKDraw869DrawSprite(0)870DrawSprite(1)871end sub872873874sub RSDKLoad875LoadSpriteSheet("R4/Objects2.gif")876877// Egg Mobile878SpriteFrame(-32, -28, 64, 56, 51, 58) // #0 - Egg Bubble2 Battle879// Eggman880SpriteFrame(-32, -28, 48, 16, 1, 67) // #2 - Eggman face881882SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")883end sub884885886