Path: blob/master/Sonic 2/Scripts/LevelSelect/BGAnimation.txt
1478 views
// ----------------------------------1// RSDK Project: Sonic 22// Script Description: BG Animation Object3// Script Author: Christian Whitehead/Simon Thomley4// Unpacked by Rubberduckycooly's script unpacker5// ----------------------------------67// ========================8// Aliases9// ========================1011private alias object.propertyValue : object.hide // set from editor12private alias object.value0 : object.timer1314// Priority15public alias 0 : PRIORITY_BOUNDS16public alias 1 : PRIORITY_ACTIVE17public alias 2 : PRIORITY_ALWAYS18public alias 3 : PRIORITY_XBOUNDS19public alias 4 : PRIORITY_XBOUNDS_DESTROY20public alias 5 : PRIORITY_INACTIVE21public alias 6 : PRIORITY_BOUNDS_SMALL22public alias 7 : PRIORITY_ACTIVE_SMALL2324// Ink Effects25public alias 0 : INK_NONE26public alias 1 : INK_BLEND27public alias 2 : INK_ALPHA28public alias 3 : INK_ADD29public alias 4 : INK_SUB3031// Flip Directions32public alias 0 : FLIP_NONE33public alias 1 : FLIP_X34public alias 2 : FLIP_Y35public alias 3 : FLIP_XY363738// ========================39// Static Values40// ========================4142public value BGAnimation_currentPreview = 0434445// ========================46// Events47// ========================4849event ObjectUpdate50object.timer++51object.timer &= 0x1FF5253Sin(temp0, object.timer)54if temp0 > 055if temp0 < 3256screen.yoffset = 25657else58screen.yoffset = 059end if60else61if temp0 > -3262screen.yoffset = 51263else64screen.yoffset = 76865end if66end if67end event686970event ObjectDraw71if object.hide == false72// This script doesn't only do BG animation, it also deals with drawing the zone preview at the bottom right of the screen73// BGAnimation_currentPreview is set by the Menu Control object74temp0 = screen.xcenter75temp0 -= 18076if temp0 > 077temp0 = 078end if79temp0 += screen.xcenter80DrawSpriteScreenXY(14, temp0, 198)81DrawSpriteScreenXY(BGAnimation_currentPreview, temp0, 198)82end if83end event848586event ObjectStartup87LoadSpriteSheet("LevelSelect/Icons.gif")8889// Set all BG Animation objects to active90// (There should only ever be one in a scene, though)91foreach (TypeName[BG Animation], arrayPos0, ALL_ENTITIES)92object[arrayPos0].priority = PRIORITY_ACTIVE93next9495SpriteFrame(56, -12, 32, 24, 0, 50) // Sonic vibin' - #09697// Zone previews98SpriteFrame(56, -12, 32, 24, 1, 85) // EHZ - #199SpriteFrame(56, -12, 32, 24, 34, 85) // CPZ - #2100SpriteFrame(56, -12, 32, 24, 67, 85) // ARZ - #3101SpriteFrame(56, -12, 32, 24, 100, 85) // CNZ - #4102SpriteFrame(56, -12, 32, 24, 133, 85) // HTZ - #5103SpriteFrame(56, -12, 32, 24, 166, 85) // MCZ - #6104SpriteFrame(56, -12, 32, 24, 199, 85) // HPZ - #7105SpriteFrame(56, -12, 32, 24, 180, 1) // OOZ - #8106SpriteFrame(56, -12, 32, 24, 213, 1) // MTZ - #9107SpriteFrame(56, -12, 32, 24, 180, 26) // SCZ - #10108SpriteFrame(56, -12, 32, 24, 213, 26) // WFZ - #11109SpriteFrame(56, -12, 32, 24, 180, 51) // DEZ - #12110SpriteFrame(56, -12, 32, 24, 213, 51) // Special Stage - #13111112SpriteFrame(32, -24, 80, 50, 0, 0) // Selection frame - #14113114// Default to the EHZ icon115BGAnimation_currentPreview = 1116end event117118119// ========================120// Editor Events121// ========================122123event RSDKEdit124if editor.returnVariable == true125switch editor.variableID126case EDIT_VAR_PROPVAL // property value127checkResult = object.propertyValue128break129130case 0 // hidden131checkResult = object.propertyValue132break133134end switch135else136switch editor.variableID137case EDIT_VAR_PROPVAL // property value138object.propertyValue = editor.variableValue139break140141case 0 // hidden142object.propertyValue = editor.variableValue143break144145end switch146end if147end event148149150event RSDKDraw151DrawSprite(1)152DrawSprite(0)153end event154155156event RSDKLoad157LoadSpriteSheet("LevelSelect/Icons.gif")158SpriteFrame(56, -12, 32, 24, 0, 50)159SpriteFrame(32, -24, 80, 50, 0, 0)160161AddEditorVariable("hidden")162SetActiveVariable("hidden")163AddEnumVariable("false", false)164AddEnumVariable("true", true)165end event166167168