Path: blob/master/Sonic 2/Scripts/Enemies/Bubbler.txt
1483 views
// ----------------------------------1// RSDK Project: Sonic 22// Script Description: Bubbler Object3// Script Author: Christian Whitehead/Simon Thomley4// Unpacked by Rubberduckycooly's script unpacker5// ----------------------------------67// ========================8// Aliases9// ========================1011// States12private alias 0 : BUBBLER_FALLING13private alias 1 : BUBBLER_EXPLODE1415// Path ID Aliases16private alias 0 : PATH_A171819// ========================20// Function Declarations21// ========================2223reserve function Bubbler_DebugDraw24reserve function Bubbler_DebugSpawn252627// ========================28// Function Definitions29// ========================3031private function Bubbler_DebugDraw32DrawSprite(0)33end function343536private function Bubbler_DebugSpawn37CreateTempObject(TypeName[Bubbler], 0, object.xpos, object.ypos)38end function394041// ========================42// Events43// ========================4445event ObjectUpdate46object.priority = PRIORITY_ACTIVE4748switch object.state49case BUBBLER_FALLING50object.animationTimer++51object.animationTimer &= 1552object.frame = object.animationTimer53object.frame >>= 25455object.ypos += 0x100005657ObjectTileCollision(CSIDE_FLOOR, 0, 0, PATH_A)58if checkResult == true59object.state = BUBBLER_EXPLODE60object.animationTimer = 061object.frame = 462end if6364foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)65BoxCollisionTest(C_TOUCH, object.entityPos, -2, -2, 2, 2, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)66if checkResult == true67CallFunction(Player_ProjectileHit)68end if69next70break7172case BUBBLER_EXPLODE73object.animationTimer++74if object.animationTimer >= 475object.animationTimer = 076object.frame++77if object.frame >= 1178object.type = TypeName[Blank Object]79end if80end if8182if object.frame < 1083temp0 = object.frame84temp0 -= 485temp0 >>= 186temp0 <<= 287temp0 += 488temp1 = temp089FlipSign(temp0)9091foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)92BoxCollisionTest(C_TOUCH, object.entityPos, temp0, -8, temp1, 0, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)93if checkResult == true94CallFunction(Player_Hit)95end if96next97end if98break99100end switch101end event102103104event ObjectDraw105DrawSprite(object.frame)106end event107108109event ObjectStartup110CheckCurrentStageFolder("Zone02")111if checkResult == true112LoadSpriteSheet("CPZ/Objects.gif")113SpriteFrame(-2, -2, 5, 5, 190, 141)114SpriteFrame(-2, -2, 5, 5, 196, 141)115SpriteFrame(-3, -4, 7, 7, 190, 147)116SpriteFrame(-3, -4, 7, 7, 198, 147)117SpriteFrame(-4, -6, 8, 6, 157, 2)118SpriteFrame(-4, -7, 8, 7, 148, 1)119SpriteFrame(-8, -8, 16, 8, 149, 9)120SpriteFrame(-8, -14, 16, 14, 149, 18)121SpriteFrame(-12, -15, 24, 15, 141, 33)122SpriteFrame(-12, -16, 23, 16, 142, 49)123SpriteFrame(-7, -13, 14, 14, 151, 66)124else125LoadSpriteSheet("MBZ/Objects.gif")126127// Huh?128// Just one Sprite Frame?129// And it's not even a Bubbler sprite, it's just the middle of the EHZ EggMobile...130// But then, if you look at where this sprite would be on the CPZ sheet, it's a Ball sprite! What?131SpriteFrame(-12, -12, 24, 24, 166, 1)132133// The strange thing is, Bubbler's sprites don't even exist on the MBZ sheet anyway, so I wonder how this came about...134end if135136SetTableValue(TypeName[Bubbler], DebugMode_ObjCount, DebugMode_TypesTable)137SetTableValue(Bubbler_DebugDraw, DebugMode_ObjCount, DebugMode_DrawTable)138SetTableValue(Bubbler_DebugSpawn, DebugMode_ObjCount, DebugMode_SpawnTable)139DebugMode_ObjCount++140end event141142143// ========================144// Editor Events145// ========================146147event RSDKDraw148DrawSprite(0)149end event150151152event RSDKLoad153CheckCurrentStageFolder("Zone02")154if checkResult == true155LoadSpriteSheet("CPZ/Objects.gif")156SpriteFrame(-2, -2, 5, 5, 190, 141)157else158LoadSpriteSheet("MBZ/Objects.gif")159SpriteFrame(-12, -12, 24, 24, 166, 1) // May as well stick with this frame anyway...160end if161162SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")163end event164165166