Path: blob/master/Sonic 1/Scripts/SBZ/Eggman.txt
1483 views
// ----------------------------------1// RSDK Project: Sonic 12// Script Description: SBZ Eggman Object3// Script Author: Christian Whitehead/Simon Thomley4// Unpacked by Rubberduckycooly's script unpacker5// ----------------------------------67// This Eggman object is used for the SBZ2 end cutscene8// For the game's final boss, see FZEggman instead910// ========================11// Aliases12// ========================1314private alias object.value0 : object.timer15private alias object.value1 : object.invincibilityTimer1617// Player Aliases18private alias object.value40 : player.hitboxLeft19private alias object.value38 : player.hitboxTop20private alias object.value41 : player.hitboxRight21private alias object.value39 : player.hitboxBottom2223// States24private alias 0 : SBZEGGMAN_WAITING25private alias 1 : SBZEGGMAN_LAUGH26private alias 2 : SBZEGGMAN_JUMP27private alias 3 : SBZEGGMAN_INAIR28private alias 4 : SBZEGGMAN_LAND29private alias 5 : SBZEGGMAN_FINISHED3031// Animations32private alias 0 : SBZEGGMAN_ANI_IDLE33private alias 1 : SBZEGGMAN_ANI_LAUGH34private alias 2 : SBZEGGMAN_ANI_JUMP35private alias 3 : SBZEGGMAN_ANI_HIT3637// Player Aliases38private alias object.xpos : player.xpos3940// Music Events41private alias 26 : SLOT_MUSICEVENT_BOSS4243private alias 0 : MUSICEVENT_FADETOBOSS44private alias 1 : MUSICEVENT_FADETOSTAGE45private alias 2 : MUSICEVENT_TRANSITION464748// ========================49// Events50// ========================5152event ObjectUpdate53// Handle States54switch object.state55case SBZEGGMAN_WAITING56temp0 = object.xpos57temp0 -= 0x88000058if player[0].xpos >= temp059object.state++60object.timer = 18061object.animation = SBZEGGMAN_ANI_LAUGH62end if63break6465case SBZEGGMAN_LAUGH66object.timer--67if object.timer < 068object.state++69object.timer = 1570object.animation = SBZEGGMAN_ANI_JUMP71end if72break7374case SBZEGGMAN_JUMP75object.timer--76if object.timer < 077object.state++78object.xvel = -0xFC0079object.yvel = -0x3C00080end if81break8283case SBZEGGMAN_INAIR84object.xpos += object.xvel85object.ypos += object.yvel86object.yvel += 0x240087if object.yvel == 088object.animation = SBZEGGMAN_ANI_LAUGH89object.state++90end if91break9293case SBZEGGMAN_LAND94object.animation = SBZEGGMAN_ANI_LAUGH95object.state++96break9798case SBZEGGMAN_FINISHED99break100101end switch102103// Handle Animations104switch object.animation105case SBZEGGMAN_ANI_IDLE106object.frame = 0107break108109case SBZEGGMAN_ANI_LAUGH110object.animationTimer++111if object.animationTimer == 14112object.animationTimer = 0113end if114object.frame = object.animationTimer115object.frame /= 7116object.frame++117break118119case SBZEGGMAN_ANI_JUMP120if object.yvel == 0121object.frame = 3122else123object.frame = 4124end if125break126127case SBZEGGMAN_ANI_HIT128if object.yvel == 0129object.frame = 5130else131object.frame = 6132end if133break134135end switch136137// Player Interactions138if object.invincibilityTimer != 0139object.invincibilityTimer--140end if141142// Don't know how the player is even supposed to reach Eggman in the cutscene, but make Eggman have a reaction to being hit143foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)144#platform: USE_STANDALONE145BoxCollisionTest(C_TOUCH, object.entityPos, -14, -20, 14, 16, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)146#endplatform147148#platform: USE_ORIGINS149BoxCollisionTest(C_TOUCH, object.entityPos, -14, -20, 14, 16, currentPlayer, player[currentPlayer].hitboxLeft, player[currentPlayer].hitboxTop, player[currentPlayer].hitboxRight, player[currentPlayer].hitboxBottom)150#endplatform151152if checkResult == true153if object.invincibilityTimer == 0154CallFunction(Player_CheckHit)155if checkResult == true156object.animation = SBZEGGMAN_ANI_HIT157object.invincibilityTimer = 32158else159if object.yvel == 0160object.animation = SBZEGGMAN_ANI_LAUGH161end if162end if163end if164end if165next166end event167168169event ObjectDraw170DrawSprite(object.frame)171end event172173174event ObjectStartup175LoadSpriteSheet("SBZ/Objects.gif")176SpriteFrame(-22, -23, 38, 51, 1, 209)177SpriteFrame(-22, -24, 38, 52, 42, 208)178SpriteFrame(-22, -23, 38, 51, 84, 209)179SpriteFrame(-16, -16, 46, 44, 350, 165)180SpriteFrame(-16, -23, 46, 55, 350, 210)181SpriteFrame(-22, -24, 42, 52, 225, 266)182SpriteFrame(-30, -24, 60, 44, 289, 165)183SpriteFrame(-24, -23, 54, 43, 236, 221)184SpriteFrame(-21, -25, 51, 52, 269, 213)185SpriteFrame(-22, -20, 42, 64, 225, 319)186end event187188189// ========================190// Editor Events191// ========================192193event RSDKDraw194DrawSprite(0)195end event196197198event RSDKLoad199LoadSpriteSheet("SBZ/Objects.gif")200SpriteFrame(-22, -23, 38, 51, 1, 209)201202SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")203end event204205206