Path: blob/master/Sonic 1/Scripts/SYZ/MovingBlock.txt
1483 views
// ----------------------------------1// RSDK Project: Sonic 12// Script Description: Moving Block Object3// Script Author: Christian Whitehead/Simon Thomley4// Unpacked by Rubberduckycooly's script unpacker5// ----------------------------------67// ========================8// Aliases9// ========================1011// Push Button aliases12private alias object.propertyValue : pushButton.stood1314private alias object.value0 : object.movePos1516private alias 0 : MOVINGBLOCK_WAITFORBUTTON17private alias 1 : MOVINGBLOCK_MOVING18private alias 2 : MOVINGBLOCK_FINISHED1920// Player Aliases21private alias object.xpos : player.xpos22private alias object.ypos : player.ypos232425// ========================26// Function Declarations27// ========================2829reserve function MovingBlock_DebugDraw30reserve function MovingBlock_DebugSpawn313233// ========================34// Tables35// ========================3637private function MovingBlock_DebugDraw38DrawSprite(0)39end function404142private function MovingBlock_DebugSpawn43CreateTempObject(TypeName[Moving Block], 0, object.xpos, object.ypos)44end function454647// ========================48// Events49// ========================5051event ObjectUpdate52switch object.state53case MOVINGBLOCK_WAITFORBUTTON54if pushButton[-1].stood == true55object.state = MOVINGBLOCK_MOVING56object.priority = PRIORITY_ACTIVE57end if58break5960case MOVINGBLOCK_MOVING61if object.movePos < 0x38A000062object.movePos += 0x1000063object.xpos += 0x1000064object.xvel = 0x1000065else66object.xvel = 067object.priority = PRIORITY_BOUNDS68object.state++69end if70break7172case MOVINGBLOCK_FINISHED73break7475end switch7677foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)78BoxCollisionTest(C_SOLID, object.entityPos, -32, -26, 32, 26, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)79if checkResult == COL_TOP80player[currentPlayer].xpos += object.xvel81end if82next83end event848586event ObjectDraw87DrawSprite(0)88end event899091event ObjectStartup92LoadSpriteSheet("SYZ/Objects.gif")93SpriteFrame(-32, -26, 64, 52, 119, 99)9495SetTableValue(TypeName[Moving Block], DebugMode_ObjCount, DebugMode_TypesTable)96SetTableValue(MovingBlock_DebugDraw, DebugMode_ObjCount, DebugMode_DrawTable)97SetTableValue(MovingBlock_DebugSpawn, DebugMode_ObjCount, DebugMode_SpawnTable)98DebugMode_ObjCount++99end event100101102// ========================103// Editor Events104// ========================105106event RSDKDraw107DrawSprite(0)108109if editor.showGizmos == true110editor.drawingOverlay = true111112// Draw an arrow from this object's activator button113DrawArrow(object[-1].xpos, object[-1].ypos, object.xpos, object.ypos, 255, 255, 255)114115editor.drawingOverlay = false116end if117end event118119120event RSDKLoad121LoadSpriteSheet("SYZ/Objects.gif")122SpriteFrame(-32, -26, 64, 52, 119, 99)123124SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")125end event126127128