Path: blob/master/Sonic 2/Scripts/Enemies/Masher.txt
1480 views
// ----------------------------------1// RSDK Project: Sonic 22// Script Description: Masher Object3// Script Author: Christian Whitehead/Simon Thomley4// Unpacked by Rubberduckycooly's script unpacker5// ----------------------------------67// ========================8// Aliases9// ========================1011private alias object.value1 : object.startPos.y1213// Player Aliases14private alias object.value38 : player.hitboxLeft15private alias object.value39 : player.hitboxRight16private alias object.value40 : player.hitboxTop17private alias object.value41 : player.hitboxBottom181920// ========================21// Function Declarations22// ========================2324reserve function Masher_DebugDraw25reserve function Masher_DebugSpawn262728// ========================29// Function Definitions30// ========================3132private function Masher_DebugDraw33DrawSpriteFX(0, FX_FLIP, object.xpos, object.ypos)34end function353637private function Masher_DebugSpawn38CreateTempObject(TypeName[Masher], 0, object.xpos, object.ypos)3940// Mashers don't normally have the capability to be turned around in the scene (aside from the actual dir attr), but they made it so that they can be turned around in Debug Mode41// Neat42GetBit(temp0, object.direction, 0)43object[tempObjectPos].direction = temp04445object[tempObjectPos].startPos.y = object.ypos46object[tempObjectPos].yvel = -0x5000047end function484950// ========================51// Events52// ========================5354event ObjectUpdate55object.ypos += object.yvel56object.yvel += 0x18005758if object.ypos > object.startPos.y59object.ypos = object.startPos.y60object.yvel = -0x5000061end if6263foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)64BoxCollisionTest(C_TOUCH, object.entityPos, -12, -14, 12, 14, currentPlayer, player[currentPlayer].hitboxLeft, player[currentPlayer].hitboxTop, player[currentPlayer].hitboxRight, player[currentPlayer].hitboxBottom)65if checkResult == true66CallFunction(Player_BadnikBreak)67end if68next6970if object.yvel < 071object.frame = object.animationTimer72object.frame >>= 373object.animationTimer++74object.animationTimer &= 1575else76object.frame = 077object.animationTimer = 078end if79end event808182event ObjectDraw83DrawSpriteFX(object.frame, FX_FLIP, object.xpos, object.ypos)84end event858687event ObjectStartup88CheckCurrentStageFolder("Zone01")89if checkResult == true90LoadSpriteSheet("EHZ/Objects.gif")91SpriteFrame(-10, -16, 20, 32, 105, 67)92SpriteFrame(-11, -16, 26, 30, 100, 100)93else94LoadSpriteSheet("MBZ/Objects.gif")95SpriteFrame(-10, -16, 20, 32, 66, 313)96SpriteFrame(-11, -16, 26, 30, 66, 346)97end if9899foreach (TypeName[Masher], arrayPos0, ALL_ENTITIES)100object[arrayPos0].startPos.y = object[arrayPos0].ypos101object[arrayPos0].yvel = -0x50000102next103104SetTableValue(TypeName[Masher], DebugMode_ObjCount, DebugMode_TypesTable)105SetTableValue(Masher_DebugDraw, DebugMode_ObjCount, DebugMode_DrawTable)106SetTableValue(Masher_DebugSpawn, DebugMode_ObjCount, DebugMode_SpawnTable)107DebugMode_ObjCount++108end event109110111// ========================112// Editor Events113// ========================114115event RSDKDraw116DrawSpriteFX(0, FX_FLIP, object.xpos, object.ypos)117end event118119120event RSDKLoad121CheckCurrentStageFolder("Zone01")122if checkResult == true123LoadSpriteSheet("EHZ/Objects.gif")124SpriteFrame(-10, -16, 20, 32, 105, 67)125else126LoadSpriteSheet("MBZ/Objects.gif")127SpriteFrame(-10, -16, 20, 32, 66, 313)128end if129130SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")131end event132133134