Path: blob/master/Sonic 2/Scripts/WFZ/TiltPlatformV.txt
1480 views
// ----------------------------------1// RSDK Project: Sonic 22// Script Description: Tilt Platform V 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_V_IDLE15private alias 1 : TILTPLATFORM_V_FLIPPING16private alias 2 : TILTPLATFORM_V_FLIPPED17private alias 3 : TILTPLATFORM_V_REVERT181920// ========================21// Function Declarations22// ========================2324reserve function TiltPlatformV_DebugDraw25reserve function TiltPlatformV_DebugSpawn262728// ========================29// Function Definitions30// ========================3132private function TiltPlatformV_DebugDraw33DrawSprite(0)34end function353637private function TiltPlatformV_DebugSpawn38CreateTempObject(TypeName[Tilt Platform V], 0, object.xpos, object.ypos)39object[tempObjectPos].direction = object.direction40end function414243// ========================44// Events45// ========================4647event ObjectUpdate48switch object.state49case TILTPLATFORM_V_IDLE50temp0 = oscillation51temp0 &= 0xF052if temp0 == object.propertyValue53object.priority = PRIORITY_ACTIVE54object.animationTimer = 055object.frame = 156object.state = TILTPLATFORM_V_FLIPPING57end if58break5960case TILTPLATFORM_V_FLIPPING61object.animationTimer++62if object.animationTimer == 463object.frame = 264object.timer = 7465object.state = TILTPLATFORM_V_FLIPPED66end if67break6869case TILTPLATFORM_V_FLIPPED70object.timer--71if object.timer == 072object.animationTimer = 073object.frame = 174object.state = TILTPLATFORM_V_REVERT75end if76break7778case TILTPLATFORM_V_REVERT79object.animationTimer++80if object.animationTimer == 481object.frame = 082object.state = TILTPLATFORM_V_IDLE83end if84break8586end switch8788if object.frame == 089foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)90BoxCollisionTest(C_SOLID, object.entityPos, -4, -24, 4, 24, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)91next92end if9394if object.outOfBounds == true95object.frame = 096object.state = TILTPLATFORM_V_IDLE97object.priority = PRIORITY_BOUNDS98end if99end event100101102event ObjectDraw103DrawSpriteFX(object.frame, FX_FLIP, object.xpos, object.ypos)104end event105106107event ObjectStartup108LoadSpriteSheet("SCZ/Objects.gif")109SpriteFrame(-4, -24, 8, 48, 311, 99) // Diagonal (Down Left) - #0110SpriteFrame(-16, -16, 32, 32, 320, 108) // Diagonal (Down Right) - #1111SpriteFrame(-24, -4, 48, 8, 320, 99) // Flat (H) - #2112SpriteFrame(-16, -16, 32, 32, 353, 108) // Flat (V) - #3113114SetTableValue(TypeName[Tilt Platform V], DebugMode_ObjCount, DebugMode_TypesTable)115SetTableValue(TiltPlatformV_DebugDraw, DebugMode_ObjCount, DebugMode_DrawTable)116SetTableValue(TiltPlatformV_DebugSpawn, DebugMode_ObjCount, DebugMode_SpawnTable)117DebugMode_ObjCount++118end event119120121// ========================122// Editor Events123// ========================124125event RSDKDraw126DrawSprite(0)127end event128129130event RSDKLoad131LoadSpriteSheet("SCZ/Objects.gif")132SpriteFrame(-4, -24, 8, 48, 311, 99) // Diagonal (Down Left)133134SetVariableAlias(ALIAS_VAR_PROPVAL, "intervalOffset")135end event136137138