Path: blob/master/Sonic 1/Scripts/Global/BonusPoints.txt
1480 views
// ----------------------------------1// RSDK Project: Sonic 12// Script Description: Bonus Points Object3// Script Author: Christian Whitehead/Simon Thomley4// Unpacked by Rubberduckycooly's script unpacker5// ----------------------------------67// ========================8// Aliases9// ========================1011private alias object.value0 : object.timer12private alias object.value1 : object.pointsAmount1314private alias 0 : BONUSPOINTS_HIDDEN15private alias 1 : BONUSPOINTS_VISIBLE161718// ========================19// Events20// ========================2122event ObjectUpdate23if object.state == BONUSPOINTS_HIDDEN24// Interact with player(s)25foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)26BoxCollisionTest(C_TOUCH, object.entityPos, -8, -8, 8, 8, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)27if checkResult == true28// Show the object29object.state = BONUSPOINTS_VISIBLE30object.drawOrder = 531object.inkEffect = INK_ALPHA32object.alpha = 0x10033PlaySfx(SfxName[Bonus Points], false)34player.score += object.pointsAmount35end if36next37else38object.timer++3940if object.timer > 10541object.alpha -= 1642end if4344if object.timer == 12045object.type = TypeName[Blank Object]46end if47end if48end event495051event ObjectDraw52// Only show after the player has touched it53if object.state == BONUSPOINTS_VISIBLE54#platform: USE_ORIGINS55if game.playMode == BOOT_PLAYMODE_MIRRORING56object.direction = FLIP_X57// We lose the fade out in Mirror Mode, oh well58DrawSpriteFX(object.propertyValue, FX_FLIP, object.xpos, object.ypos)59else60DrawSpriteFX(object.propertyValue, FX_INK, object.xpos, object.ypos)61end if62#endplatform63#platform: USE_STANDALONE64DrawSpriteFX(object.propertyValue, FX_INK, object.xpos, object.ypos)65#endplatform66end if67end event686970event ObjectStartup71LoadSpriteSheet("Global/Display.gif")7273foreach (TypeName[Bonus Points], arrayPos0, ALL_ENTITIES)74// Choose point value based on property value7576object[arrayPos0].propertyValue &= 377switch object[arrayPos0].propertyValue78default79case 080// No bonus at all (though, 10000 will still be displayed if this object is touched)81break8283case 184object[arrayPos0].pointsAmount = 1000085break8687case 288object[arrayPos0].pointsAmount = 100089break9091case 392object[arrayPos0].pointsAmount = 10093break9495end switch96next9798// Sprite frames99SpriteFrame(-16, -12, 31, 23, 225, 49) // 10000 Points (No Points, functionality-wise) - #0100SpriteFrame(-16, -12, 31, 23, 225, 49) // 10000 Points - #1101SpriteFrame(-16, -12, 31, 23, 225, 25) // 1000 Points - #2102SpriteFrame(-16, -12, 31, 23, 225, 1) // 100 Points - #3103end event104105106// ========================107// Editor Events108// ========================109110event RSDKEdit111if editor.returnVariable == true112switch editor.variableID113case EDIT_VAR_PROPVAL // property value114checkResult = object.propertyValue115checkResult &= 3116break117118case 0 // pointsAmount119checkResult = object.propertyValue120checkResult &= 3121break122123end switch124else125switch editor.variableID126case EDIT_VAR_PROPVAL // property value127object.propertyValue = editor.variableValue128object.propertyValue &= 3129break130131case 0 // pointsAmount132object.propertyValue = editor.variableValue133object.propertyValue &= 3134break135136end switch137end if138end event139140141event RSDKDraw142temp0 = object.propertyValue143temp0 &= 3144DrawSprite(temp0)145end event146147148event RSDKLoad149LoadSpriteSheet("Global/Display.gif")150SpriteFrame(-16, -12, 31, 23, 225, 49)151SpriteFrame(-16, -12, 31, 23, 225, 49)152SpriteFrame(-16, -12, 31, 23, 225, 25)153SpriteFrame(-16, -12, 31, 23, 225, 1)154155AddEditorVariable("pointsAmount")156SetActiveVariable("pointsAmount")157AddEnumVariable("No Points", 0)158AddEnumVariable("10,000 Points", 1)159AddEnumVariable("1,000 Points", 2)160AddEnumVariable("100 Points", 3)161end event162163164