Path: blob/master/Sonic 1/Scripts/LZ/HarpoonHoriz.txt
1483 views
// ----------------------------------1// RSDK Project: Sonic 12// Script Description: Harpoon H Object3// Script Author: Christian Whitehead/Simon Thomley4// Unpacked by Rubberduckycooly's script unpacker5// ----------------------------------67// ========================8// Aliases9// ========================1011private alias object.value0 : object.timer12private alias object.value1 : object.hitboxL13private alias object.value2 : object.hitboxR1415// ========================16// Function Declarations17// ========================1819reserve function HarpoonH_DebugDraw20reserve function HarpoonH_DebugSpawn212223// ========================24// Tables25// ========================2627private table HarpoonH_delayTable2866, 4, 66, 429end table3031private table HarpoonH_frameTable320, 1, 2, 133end table3435private table HarpoonH_sizeTable368, 24, 40, 2437end table383940// ========================41// Function Definitions42// ========================4344private function HarpoonH_DebugDraw45DrawSpriteFX(0, FX_FLIP, object.xpos, object.ypos)46end function474849private function HarpoonH_DebugSpawn50CreateTempObject(TypeName[Harpoon H], 0, object.xpos, object.ypos)51object[tempObjectPos].direction = object.direction52end function535455// ========================56// Events57// ========================5859event ObjectUpdate60if object.animationTimer == 061object.timer++62if object.timer >= 463object.timer = 064end if65GetTableValue(object.animationTimer, object.timer, HarpoonH_delayTable)66GetTableValue(object.frame, object.timer, HarpoonH_frameTable)67else68object.animationTimer--69end if7071object.hitboxL = -872GetTableValue(object.hitboxR, object.timer, HarpoonH_sizeTable)73GetBit(temp0, object.direction, 0)7475if temp0 == FLIP_X76FlipSign(object.hitboxL)77FlipSign(object.hitboxR)78temp0 = object.hitboxR79object.hitboxR = object.hitboxL80object.hitboxL = temp081end if8283// Check interaction with players84foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)85BoxCollisionTest(C_TOUCH, object.entityPos, object.hitboxL, -4, object.hitboxR, 4, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)86if checkResult == true87CallFunction(Player_Hit)88end if89next90end event919293event ObjectDraw94DrawSpriteFX(object.frame, FX_FLIP, object.xpos, object.ypos)95end event969798event ObjectStartup99LoadSpriteSheet("LZ/Objects.gif")100101// Harpoon frames102SpriteFrame(-8, -4, 16, 8, 196, 129)103SpriteFrame(-8, -4, 32, 8, 158, 163)104SpriteFrame(-8, -4, 48, 8, 94, 115)105106// Add this object to the debug item list107SetTableValue(TypeName[Harpoon H], DebugMode_ObjCount, DebugMode_TypesTable)108SetTableValue(HarpoonH_DebugDraw, DebugMode_ObjCount, DebugMode_DrawTable)109SetTableValue(HarpoonH_DebugSpawn, DebugMode_ObjCount, DebugMode_SpawnTable)110DebugMode_ObjCount++111end event112113114// ========================115// Editor Events116// ========================117118event RSDKDraw119DrawSpriteFX(0, FX_FLIP, object.xpos, object.ypos)120end event121122123event RSDKLoad124LoadSpriteSheet("LZ/Objects.gif")125SpriteFrame(-8, -4, 48, 8, 94, 115)126127// Direction attr should be used128SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")129end event130131132