Path: blob/main/Scripts/R7/Flower.txt
1319 views
//-------------------Sonic CD Flower Script-------------------//1//--------Scripted by Christian Whitehead 'The Taxman'--------//2//-------Unpacked By Rubberduckycooly's Script Unpacker-------//34// Aliases5#alias Object.Value0 : Object.Timer67// States8#alias 0 : FLOWER_SEED_SPAWN9#alias 1 : FLOWER_SEED_FALL1011#alias 2 : FLOWER_SEED_PLANTED_112#alias 3 : FLOWER_SEED_PLANTED_213#alias 4 : FLOWER_SEED_PLANTED_31415#alias 5 : FLOWER_ROOT_GROWTH_116#alias 6 : FLOWER_ROOT_GROWTH_217#alias 7 : FLOWER_ROOT_GROWTH_31819#alias 8 : FLOWER_ANIM_220#alias 9 : FLOWER_ANIM_32122// Collision Sides23#alias 0 : CSIDE_FLOOR242526sub ObjectMain27switch Object.State28case FLOWER_SEED_SPAWN29// Hover as a seed for a brief moment3031// Frame 8 is the invisible frame32Object.Frame = 833Object.Timer++34if Object.Timer == 2035Object.Timer = 036Object.State++37end if38break3940case FLOWER_SEED_FALL41Object.Frame = Object.Timer42Object.Frame >>= 24344Object.Timer++45Object.Timer &= 74647// Fall at a graceful speed of 2 pixels per frame48Object.YPos += 0x200004950// Check if the Flower has touched the ground51ObjectTileCollision(CSIDE_FLOOR, 0, 8, 0)52if CheckResult == true53// If it has, then turn it into a full-on Flower5455// First, move the seed 8 pixels down since Flowers' offsets are further than that of seeds56Object.YPos += 0x800005758Object.State++59Object.Timer = 060Object.Frame = 261end if62break6364// All the growth animation frames are their own mini-state, just about the same thing6566case FLOWER_SEED_PLANTED_167Object.Timer++68if Object.Timer == 469Object.Timer = 070Object.State++71Object.Frame = 372end if73break7475case FLOWER_SEED_PLANTED_276Object.Timer++77if Object.Timer == 478Object.Timer = 079Object.State++80Object.Frame = 281end if82break8384case FLOWER_SEED_PLANTED_385Object.Timer++86if Object.Timer == 487Object.Timer = 088Object.State++89Object.Frame = 390end if91break9293case FLOWER_ROOT_GROWTH_194Object.Timer++95if Object.Timer == 596Object.Timer = 097Object.State++98Object.Frame = 499end if100break101102case FLOWER_ROOT_GROWTH_2103Object.Timer++104if Object.Timer == 4105Object.Timer = 0106Object.State++107Object.Frame = 5108end if109break110111case FLOWER_ROOT_GROWTH_3112Object.Timer++113if Object.Timer == 2114Object.Timer = 0115Object.State++116Object.Frame = 6117end if118break119120// Similarly, the main flower animation is also comprised of two near-identical states121122case FLOWER_ANIM_2123Object.Timer++124if Object.Timer == 20125Object.Timer = 0126Object.State++127Object.Frame = 7128end if129break130131case FLOWER_ANIM_3132Object.Timer++133if Object.Timer == 20134Object.Timer = 0135Object.State--136Object.Frame = 6137end if138break139140end switch141end sub142143144sub ObjectDraw145DrawSprite(Object.Frame)146end sub147148149sub ObjectStartup150LoadSpriteSheet("R7/Objects2.gif")151152SpriteFrame(-4, -8, 8, 16, 26, 170) // #0 - Seed Frame 0153SpriteFrame(-4, -8, 8, 16, 35, 170) // #1 - Seed Frame 1154155SpriteFrame(-8, -8, 16, 16, 44, 170) // #2 - Planted Seed Frame 0156SpriteFrame(-8, -8, 16, 16, 26, 187) // #3 - Planted Seed Frame 1157158SpriteFrame(0, -8, 8, 16, 66, 99) // #4 - Flower Growth Frame 0159SpriteFrame(-12, -24, 24, 24, 66, 25) // #5 - Flower Growth Frame 1160161SpriteFrame(-12, -48, 24, 48, 66, 1) // #6 - Flower Frame 0162SpriteFrame(-12, -48, 24, 48, 66, 50) // #7 - Flower Frame 1163164SpriteFrame(0, 0, 0, 0, 73, 132) // #8 - Cheat Sprite, blank frame165166end sub167168169// ========================170// Editor Subs171// ========================172173sub RSDKDraw174DrawSprite(0)175end sub176177178sub RSDKLoad179LoadSpriteSheet("R7/Objects2.gif")180SpriteFrame(-12, -48, 24, 48, 66, 1)181182SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")183end sub184185186