Path: blob/master/Sonic 1/Scripts/Enemies/Chopper.txt
1480 views
// ----------------------------------1// RSDK Project: Sonic 12// Script Description: Chopper Object3// Script Author: Christian Whitehead/Simon Thomley4// Unpacked by Rubberduckycooly's script unpacker5// ----------------------------------67// ========================8// Aliases9// ========================1011private alias object.value1 : object.startPos.y1213private alias 0 : CHOPPER_ANI_JUMP14private alias 1 : CHOPPER_ANI_BITE15private alias 2 : CHOPPER_ANI_FALL1617// Player Aliases18private alias object.value40 : player.hitboxLeft19private alias object.value38 : player.hitboxTop20private alias object.value41 : player.hitboxRight21private alias object.value39 : player.hitboxBottom222324// ========================25// Function Declarations26// ========================2728reserve function Chopper_DebugDraw29reserve function Chopper_DebugSpawn303132// ========================33// Function Definitions34// ========================3536private function Chopper_DebugDraw37DrawSpriteFX(0, FX_FLIP, object.xpos, object.ypos)38end function394041private function Chopper_DebugSpawn42CreateTempObject(TypeName[Chopper], 0, object.xpos, object.ypos)4344// Choppers 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 Mode45// Neat46GetBit(temp0, object.direction, 0)47object[tempObjectPos].direction = temp04849object[tempObjectPos].startPos.y = object.ypos50object[tempObjectPos].yvel = -0x7000051end function525354// ========================55// Events56// ========================5758event ObjectUpdate59object.ypos += object.yvel60object.yvel += 0x18006162if object.yvel < -0x3800063object.animation = CHOPPER_ANI_JUMP64else65if object.yvel > 0x3800066object.animation = CHOPPER_ANI_FALL67else68object.animation = CHOPPER_ANI_BITE69end if70end if7172if object.ypos > object.startPos.y73object.ypos = object.startPos.y74object.yvel = -0x7000075end if7677foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)78BoxCollisionTest(C_TOUCH, object.entityPos, -12, -14, 12, 14, currentPlayer, player[currentPlayer].hitboxLeft, player[currentPlayer].hitboxTop, player[currentPlayer].hitboxRight, player[currentPlayer].hitboxBottom)79if checkResult == true80CallFunction(Player_BadnikBreak)81end if82next8384switch object.animation85case CHOPPER_ANI_JUMP86object.frame = object.animationTimer87object.frame >>= 388object.animationTimer++89object.animationTimer &= 1590break9192case CHOPPER_ANI_BITE93object.frame = object.animationTimer94object.frame >>= 395object.animationTimer += 296object.animationTimer &= 1597break9899case CHOPPER_ANI_FALL100object.frame = 0101break102103end switch104end event105106107event ObjectDraw108DrawSpriteFX(object.frame, FX_FLIP, object.xpos, object.ypos)109end event110111112event ObjectStartup113CheckCurrentStageFolder("Zone01")114if checkResult == true115LoadSpriteSheet("GHZ/Objects.gif")116SpriteFrame(-14, -15, 30, 32, 98, 94)117SpriteFrame(-14, -15, 30, 32, 129, 94)118end if119120CheckCurrentStageFolder("Zone07")121if checkResult == true122LoadSpriteSheet("MBZ/Objects.gif")123SpriteFrame(-14, -15, 30, 32, 106, 81)124SpriteFrame(-14, -15, 30, 32, 137, 81)125end if126127foreach (TypeName[Chopper], arrayPos0, ALL_ENTITIES)128object[arrayPos0].startPos.y = object[arrayPos0].ypos129object[arrayPos0].yvel = -0x70000130next131132SetTableValue(TypeName[Chopper], DebugMode_ObjCount, DebugMode_TypesTable)133SetTableValue(Chopper_DebugDraw, DebugMode_ObjCount, DebugMode_DrawTable)134SetTableValue(Chopper_DebugSpawn, DebugMode_ObjCount, DebugMode_SpawnTable)135DebugMode_ObjCount++136end event137138139// ========================140// Editor Events141// ========================142143event RSDKDraw144DrawSprite(0)145end event146147148event RSDKLoad149CheckCurrentStageFolder("Zone07")150if checkResult == true151LoadSpriteSheet("MBZ/Objects.gif")152SpriteFrame(-14, -15, 30, 32, 106, 81)153else154LoadSpriteSheet("GHZ/Objects.gif")155SpriteFrame(-14, -15, 30, 32, 98, 94)156end if157158SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")159end event160161162