Path: blob/main/Scripts/R7/Amy1.txt
1319 views
//-------------------Sonic CD Amy 1 Script--------------------//1//--------Scripted by Christian Whitehead 'The Taxman'--------//2//-------Unpacked By Rubberduckycooly's Script Unpacker-------//34// Aliases56// Values0-1 are skipped over... possibly to keep values parallel with the Amy 2 object7#alias Object.Value2 : Object.YVelocity8#alias Object.Value3 : Object.Bounds.Left9#alias Object.Value4 : Object.Bounds.Right1011// States12#alias 0 : AMY1_CAUGHT13#alias 1 : AMY1_FALLING1415// Player Aliases16#alias 0 : PLAYER_SONIC_A1718// Collision Sides19#alias 0 : CSIDE_FLOOR2021// Global SFX22#alias 22 : SFX_G_EXPLOSION2324// Game Mode Aliases25#alias 2 : MODE_TIMEATTACK262728sub ObjectMain2930// (AMY1_CAUGHT has no code here, all of that state's stuff is done over in PlayerObjectCollision)3132if Object.State == AMY1_FALLING3334// Update falling movements35Object.YPos += Object.YVelocity3637// Gravity of 0.125 pixels per frame38Object.YVelocity += 0x20003940// Check if Amy's touched the floor41ObjectTileCollision(CSIDE_FLOOR, 0, 19, 0)42if CheckResult == true4344// Amy's landed on the ground now, replace her with an Amy 2 object45ResetObjectEntity(Object.EntityNo, TypeName[Amy 2], 0, Object.XPos, Object.YPos)4647Object.Frame = 448Object.DrawOrder = 44950// Set Amy's bounds to make sure she doesn't go too far51// they're hardcoded positions btw :(52Object.Bounds.Left = 0x3EA40000 // Left bounds (16036 with the in-game debug position display)53Object.Bounds.Right = 0x40000000 // Right bounds (16384 with the in-game debug position display)5455#platform: Use_Origins56// Some additional stuff for Origins5758// Let the game know we've finished the boss!59// This is somewhat unused, as in ths Boss Rush, Metal Sonic already does this same thing,60// so Amy never gets a turn before the stage switches61// In normal play this hits, though at that point it doesn't really have any effect at all62game.callbackParam0 = true63EngineCallback(NOTIFY_BOSS_END)6465if game.playMode == BOOT_PLAYMODE_BOSSRUSH66// This code will never hit at all, check out above6768StopMusic()69end if70#endplatform7172end if73end if7475end sub767778sub ObjectPlayerInteraction7980// (The opposite case of ObjectMain, there's nothing for AMY1_FALLING at all here)8182if Object.State == AMY1_CAUGHT8384// Due to how the engine works, there's a single frame upon landing where this code is actually85// being run from an Amy 2 object, so check against that86// This check was only introduced in an update, so it's not in the 2012 Steam version or anything8788if Object.Type == TypeName[Amy 1]8990// Check if Sonic's hit Amy91PlayerObjectCollision(C_TOUCH, -8, -16, 8, 16)92if CheckResult == true93// Free Amy if Sonic broke the rope (?)9495// Bounce Sonic off96FlipSign(Player.YVelocity)97Player.YVelocity >>= 19899// And start Amy's descent100Object.State = AMY1_FALLING101Object.Frame >>= 3102103// Create an Explosion for the rope (?) just broken104CreateTempObject(TypeName[Explosion], 0, Object.XPos, Object.YPos)105106// And that wraps up the stage!107Stage.TimeEnabled = false108109PlaySfx(SFX_G_EXPLOSION, false)110111end if112113end if114115end if116117end sub118119120sub ObjectDraw121122if Object.State == AMY1_CAUGHT123TempValue0 = Object.Frame124TempValue0 >>= 3125DrawSprite(TempValue0)126127// Animation is done here as well128Object.Frame++129Object.Frame &= 31130else131// Stay static while falling down132133DrawSprite(Object.Frame)134end if135136end sub137138139sub ObjectStartup140141LoadSpriteSheet("R7/Objects2.gif")142143// Erase all Amy 1 objects in the level if she's not supposed to appear144ArrayPos0 = 32145while ArrayPos0 < 1056146if Object[ArrayPos0].Type == TypeName[Amy 1]147148// Only appear for Sonic149if Stage.PlayerListPos == PLAYER_SONIC_A // PLAYER_SONIC in origins150if Options.GameMode == MODE_TIMEATTACK151// Don't appear in time attack, unload152153Object[ArrayPos0].Type = TypeName[Blank Object]154else155// All conditions passed - Amy can continue as normal156157// Have her draw above Sonic,158Object[ArrayPos0].DrawOrder = 4159end if160else161// Amy doesn't care about Tails, unload162163Object[ArrayPos0].Type = TypeName[Blank Object]164end if165166end if167168ArrayPos0++169loop170171// Amy Frames172173// 0-3 - Hanging Frames174SpriteFrame(-12, -20, 24, 40, 1, 170)175SpriteFrame(-12, -20, 24, 40, 1, 211)176SpriteFrame(-12, -20, 24, 40, 124, 109)177SpriteFrame(-12, -20, 24, 40, 1, 211)178179end sub180181182// ========================183// Editor Subs184// ========================185186sub RSDKDraw187DrawSprite(0)188end sub189190191sub RSDKLoad192LoadSpriteSheet("R7/Objects2.gif")193SpriteFrame(-12, -20, 24, 40, 1, 170)194195SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")196end sub197198199