Path: blob/master/Sonic 1/Scripts/Mission/WatchLoseRing.txt
1482 views
// ----------------------------------1// RSDK Project: Sonic 12// Script Description: WatchLoseRing Object3// Script Author: Christian Whitehead/Simon Thomley4// Unpacked by Rubberduckycooly's script unpacker5// ----------------------------------67// ========================8// Aliases9// ========================1011private alias object.value0 : object.targetRing1213// TODO: primitive names14private alias 0 : WATCHLOSERING_AWAITHURT15private alias 1 : WATCHLOSERING_FINDRING16private alias 2 : WATCHLOSERING_WATCHRING1718// Player Aliases19private alias object.state : player.state202122// ========================23// Events24// ========================2526event ObjectUpdate27switch object.state28case WATCHLOSERING_AWAITHURT29if player[0].state == Player_State_GotHit30object.state = WATCHLOSERING_FINDRING31end if32break3334case WATCHLOSERING_FINDRING35foreach (TypeName[Lose Ring], arrayPos0, ACTIVE_ENTITIES)36object.targetRing = arrayPos037next3839if object.targetRing != 040object.state = WATCHLOSERING_WATCHRING41end if42break4344case WATCHLOSERING_WATCHRING45arrayPos0 = object.targetRing46if object[arrayPos0].type == TypeName[Ring Sparkle]47// The Player grabbed the ring, now find the next ring48object.targetRing = 049object.state = WATCHLOSERING_FINDRING50else51if object[arrayPos0].type == TypeName[Blank Object]52// The Player wasn't fast enough and the Ring despawned, kill the Player53object.targetRing = 054object.state = WATCHLOSERING_FINDRING5556game.forceKillPlayer = true57end if58end if59break6061end switch62end event636465event ObjectStartup66// Normally I'd say like "Cycle through all WatchLoseRing Objects in the stage and set them to active" but like...67foreach (TypeName[WatchLoseRing], arrayPos0, ALL_ENTITIES)68object[arrayPos0].priority = PRIORITY_ACTIVE69end if // ???pardon? an end if??? It's supposed to be a `next` instead...7071// As it is now, it seems like this foreach only really finds the first WatchLoseRing Object and then just stops after that...72// It doesn't matter too much though, as only one (or none) should ever be placed into a scene73end event747576// ========================77// Editor Events78// ========================7980event RSDKDraw81DrawSprite(0)82end event838485event RSDKLoad86LoadSpriteSheet("Global/Items.gif")87SpriteFrame(-8, -8, 16, 16, 1, 1)8889SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")90end event919293