Path: blob/master/Sonic 2/Scripts/WFZ/TiltPlatformM.txt
1480 views
// ----------------------------------1// RSDK Project: Sonic 22// Script Description: Tilt Platform M Object3// Script Author: Christian Whitehead/Simon Thomley4// Unpacked by Rubberduckycooly's script unpacker5// ----------------------------------67// ========================8// Aliases9// ========================1011private alias object.value0 : object.timer1213// States14private alias 0 : TILTPLATFORM_M_IDLE15private alias 1 : TILTPLATFORM_M_ACTIVATED16private alias 2 : TILTPLATFORM_M_FLIPPING17private alias 3 : TILTPLATFORM_M_FLIPPED18private alias 4 : TILTPLATFORM_M_REVERT1920// Player Aliases21private alias object.xpos : player.xpos222324// ========================25// Function Declarations26// ========================2728reserve function TiltPlatformM_DebugDraw29reserve function TiltPlatformM_DebugSpawn303132// ========================33// Function Definitions34// ========================3536private function TiltPlatformM_DebugDraw37DrawSprite(0)38end function394041private function TiltPlatformM_DebugSpawn42CreateTempObject(TypeName[Tilt Platform M], 0, object.xpos, object.ypos)43object[tempObjectPos].direction = object.direction44end function454647// ========================48// Events49// ========================5051event ObjectUpdate52switch object.state53case TILTPLATFORM_M_IDLE54break5556case TILTPLATFORM_M_ACTIVATED57object.timer--58if object.timer == 059object.animationTimer = 060object.frame = 161object.state = TILTPLATFORM_M_FLIPPING62end if63break6465case TILTPLATFORM_M_FLIPPING66object.animationTimer++67if object.animationTimer == 468object.frame = 269object.timer = 7470object.state = TILTPLATFORM_M_FLIPPED71end if72break7374case TILTPLATFORM_M_FLIPPED75object.timer--76if object.timer == 077object.animationTimer = 078object.frame = 179object.state = TILTPLATFORM_M_REVERT80end if81break8283case TILTPLATFORM_M_REVERT84object.animationTimer++85if object.animationTimer == 486object.frame = 087object.state = TILTPLATFORM_M_IDLE88end if89break9091end switch9293if object.frame == 094foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)95BoxCollisionTest(C_SOLID, object.entityPos, -24, -2, 24, 6, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)96if object.state == TILTPLATFORM_M_IDLE97if checkResult == COL_TOP98if player[currentPlayer].xpos < object.xpos99object.direction = FLIP_X100else101object.direction = FLIP_NONE102end if103object.timer = 16104object.state = TILTPLATFORM_M_ACTIVATED105object.priority = PRIORITY_ACTIVE106end if107end if108next109end if110111if object.outOfBounds == true112object.frame = 0113object.state = TILTPLATFORM_M_IDLE114object.priority = PRIORITY_BOUNDS115end if116end event117118119event ObjectDraw120DrawSpriteFX(object.frame, FX_FLIP, object.xpos, object.ypos)121end event122123124event ObjectStartup125LoadSpriteSheet("SCZ/Objects.gif")126SpriteFrame(-24, -4, 48, 8, 320, 99) // Flat (H) - #0127SpriteFrame(-16, -16, 32, 32, 320, 108) // Diagonal (Down Right) - #1128SpriteFrame(-4, -24, 8, 48, 311, 99) // Diagonal (Down Left) - #2129SpriteFrame(-16, -16, 32, 32, 353, 108) // Flat (V) - #3130131SetTableValue(TypeName[Tilt Platform M], DebugMode_ObjCount, DebugMode_TypesTable)132SetTableValue(TiltPlatformM_DebugDraw, DebugMode_ObjCount, DebugMode_DrawTable)133SetTableValue(TiltPlatformM_DebugSpawn, DebugMode_ObjCount, DebugMode_SpawnTable)134DebugMode_ObjCount++135end event136137138// ========================139// Editor Events140// ========================141142event RSDKDraw143DrawSprite(0)144end event145146147event RSDKLoad148LoadSpriteSheet("SCZ/Objects.gif")149SpriteFrame(-24, -4, 48, 8, 320, 99) // Flat (H)150151SetVariableAlias(ALIAS_VAR_PROPVAL, "intervalOffset")152end event153154155