Path: blob/main/Scripts/Animals/R3_Rabbit.txt
1319 views
//-------------------Sonic CD Rabbit Script-------------------//1//--------Scripted by Christian Whitehead 'The Taxman'--------//2//-------Unpacked By Rubberduckycooly's Script Unpacker-------//34// Aliases5#alias Object.Value0 : Object.YVelocity6#alias Object.Value1 : Object.Hops78// HUD alias9#alias Object[24].PropertyValue : HUD.CurrentTimePeriod1011// States12#alias 0 : RABBIT_HOPRIGHT13#alias 1 : RABBIT_HOPLEFT1415// Collision Side Aliases16#alias 0 : CSIDE_FLOOR1718// Time Period Aliases19#alias 2 : TIME_GOOD_FUTURE202122sub ObjectMain23Object.YPos += Object.YVelocity2425// Apply a Gravity of about 0.17px per frame26Object.YVelocity += 0x2C002728switch Object.State29case RABBIT_HOPRIGHT3031// Move the Rabbit right by a pixel32Object.XPos += 0x100003334// Only check for the floor if the Rabbit's falling at a rate faster than 4px per frame35if Object.YVelocity > 0x4000036ObjectTileCollision(CSIDE_FLOOR, 0, 8, 0)3738if CheckResult == true39// Bounce back up, at a rate of 5px upwards per frame40Object.YVelocity = -0x500004142Object.Hops++4344// Upon landing from the third hop, the Rabbit should turn around45if Object.Hops == 246Object.Hops = 047Object.State = RABBIT_HOPLEFT48Object.Direction = FACING_LEFT49end if50end if51end if52break5354case RABBIT_HOPLEFT5556// Move the Rabbit a pixel left57Object.XPos -= 0x100005859// Only check for ground collision if falling faster than 4px a frame60if Object.YVelocity > 0x4000061ObjectTileCollision(CSIDE_FLOOR, 0, 8, 0)6263if CheckResult == true64// Bounce back up!6566// Starting YVel of 5px per frame67Object.YVelocity = -0x500006869// After hopping thrice, turn right around70Object.Hops++71if Object.Hops == 272Object.Hops = 073Object.State = RABBIT_HOPRIGHT74Object.Direction = FACING_RIGHT75end if76end if77end if78break7980end switch8182end sub838485sub ObjectDraw86if MetalSonic_Destroyed == true87if Object.YVelocity < 088DrawSpriteFX(0, FX_FLIP, Object.XPos, Object.YPos)89else90DrawSpriteFX(1, FX_FLIP, Object.XPos, Object.YPos)91end if92else93if HUD.CurrentTimePeriod == TIME_GOOD_FUTURE94if Object.YVelocity < 095DrawSpriteFX(0, FX_FLIP, Object.XPos, Object.YPos)96else97DrawSpriteFX(1, FX_FLIP, Object.XPos, Object.YPos)98end if99end if100end if101102end sub103104105sub ObjectStartup106LoadSpriteSheet("R3/Objects3.gif")107108SpriteFrame(-8, -12, 16, 24, 149, 1)109SpriteFrame(-8, -12, 16, 24, 166, 1)110111// Used to be below LoadSpriteSheet, moved here for consistency112// Loop through all Objects in the stage and setup all Rabbits113ArrayPos0 = 32114while ArrayPos0 < 1056115if Object[ArrayPos0].Type == TypeName[Rabbit]116117// Make the Rabbit start at a rising rate of 5px per frame118Object[ArrayPos0].YVelocity = -0x50000119120// Start facing right121Object[ArrayPos0].Direction = FACING_RIGHT122123end if124125ArrayPos0++126loop127128end sub129130131// ========================132// Editor Subs133// ========================134135sub RSDKDraw136DrawSprite(0)137end sub138139140sub RSDKLoad141LoadSpriteSheet("R3/Objects3.gif")142SpriteFrame(-8, -12, 16, 24, 149, 1)143144SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")145end sub146147148