Path: blob/main/Scripts/Global/Ring.txt
1319 views
//-------------------Sonic CD Ring Script---------------------//1//--------Scripted by Christian Whitehead 'The Taxman'--------//2//-------Unpacked By Rubberduckycooly's Script Unpacker-------//34// Aliases5#alias Object.PropertyValue : Object.DrawingPlane67// Drawing Plane Aliases8#alias 0 : DRAWINGPLANE_A9#alias 1 : DRAWINGPLANE_B1011// Player Alias12#alias Player.Value0 : Player.Rings1314// Pan15#alias 0 : PAN_RIGHT16#alias 1 : PAN_LEFT1718// Player19#alias 0 : PLAYER_SONIC_A2021// Game Mode Aliases22#alias 2 : MODE_TIMEATTACK2324// Global SFX25#alias 20 : SFX_G_1UP26#alias 21 : SFX_G_ACHIEVEMENT272829sub ObjectPlayerInteraction30if Player.State != Player_State_Hurt3132if Player.CollisionPlane == Object.DrawingPlane3334PlayerObjectCollision(C_TOUCH, -8, -8, 8, 8)35if CheckResult == true36Object.Type = TypeName[Ring Sparkle]37Player.Rings++38if Player.Rings > 99939Player.Rings = 99940end if4142if Player.Rings >= Ring.ExtraLife43if Options.GameMode != MODE_TIMEATTACK44#platform: Use_Origins45if game.coinMode == false46Player.Lives++47else48game.callbackParam0 = 1 // Set the amount of coins to add49EngineCallback(NOTIFY_ADD_COIN)50end if51#endplatform5253#platform: Use_Standalone54Player.Lives++55#endplatform5657if Stage.PlayerListPos == PLAYER_SONIC_A // PLAYER_SONIC in origins58PlaySfx(SFX_G_1UP, false)59else60PlaySfx(SFX_G_ACHIEVEMENT, false)61end if62end if6364Ring.ExtraLife += 1006566// You can only achieve 3 extra lives via rings67if Ring.ExtraLife > 30068Ring.ExtraLife = 100069end if7071// King of the Rings achievement criteria72if Player.Rings >= 20073if Stage.PlayerListPos == PLAYER_SONIC_A // PLAYER_SONIC in origins74if Stage.DebugMode == false75SetAchievement(4, 100)76end if77end if78end if79end if8081if Ring.Pan == PAN_RIGHT82SetSfxAttributes(1, -1, -100)83Ring.Pan = PAN_LEFT84else85SetSfxAttributes(2, -1, 100)86Ring.Pan = PAN_RIGHT87end if88end if8990end if9192end if9394end sub959697sub ObjectDraw98DrawSprite(Ring.Frame)99end sub100101102sub ObjectStartup103LoadSpriteSheet("Global/Items.gif")104105SpriteFrame(-8, -8, 16, 16, 1, 1) // #0 - Ring Frame 0106SpriteFrame(-8, -8, 16, 16, 1, 18) // #1 - Ring Frame 1107SpriteFrame(-8, -8, 16, 16, 1, 35) // #2 - Ring Frame 2108SpriteFrame(-8, -8, 16, 16, 1, 52) // #3 - Ring Frame 3109SpriteFrame(-8, -8, 16, 16, 1, 69) // #4 - Ring Frame 4110SpriteFrame(-8, -8, 16, 16, 1, 86) // #5 - Ring Frame 5111SpriteFrame(-8, -8, 16, 16, 1, 103) // #6 - Ring Frame 6112SpriteFrame(-8, -8, 16, 16, 1, 120) // #7 - Ring Frame 7113114// Used to be below LoadSpriteSheet, moved here for consistency115ArrayPos0 = 32116while ArrayPos0 < 1056117if Object[ArrayPos0].Type == TypeName[Ring]118if Object[ArrayPos0].DrawingPlane == DRAWINGPLANE_A119Object[ArrayPos0].DrawOrder = 4120else121Object[ArrayPos0].DrawOrder = 2122end if123end if124ArrayPos0++125loop126127end sub128129130// ========================131// Editor Subs132// ========================133134sub RSDKEdit135if Editor.ReturnVariable == true136switch Editor.VariableID137case EDIT_VAR_PROPVAL // Property Value138CheckResult = Object.PropertyValue139break140case 0 // Plane Type141CheckResult = Object.PropertyValue142break143end switch144else145switch Editor.VariableID146case EDIT_VAR_PROPVAL // Property Value147Object.PropertyValue = Editor.VariableValue148break149case 0 // Plane Type150Object.PropertyValue = Editor.VariableValue151break152end switch153end if154end sub155156157sub RSDKDraw158Object.InkEffect = Object.PropertyValue159DrawSpriteFX(0, FX_INK, Object.XPos, Object.YPos)160end sub161162163sub RSDKLoad164LoadSpriteSheet("Global/Items.gif")165SpriteFrame(-8, -8, 16, 16, 1, 1) // #0 - Ring Frame 0166167AddEditorVariable("Plane Type")168SetActiveVariable("Plane Type")169AddEnumVariable("Plane A", 0)170AddEnumVariable("Plane B", 1)171end sub172173174