Path: blob/master/Sonic 1/Scripts/SBZ/PlasmaBall.txt
1482 views
// ----------------------------------1// RSDK Project: Sonic 12// Script Description: Plasma Ball 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.targetPos.x13private alias object.value2 : object.animTimerMax14private alias object.value3 : object.animSpeed15private alias object.value4 : object.frameTable1617private alias 0 : PLASMABALL_SETUP18private alias 1 : PLASMABALL_MOVETOPOS19private alias 2 : PLASMABALL_CHARGING20private alias 3 : PLASMABALL_ACTIVE2122// Player Aliases23private alias object.xpos : player.xpos242526// ========================27// Tables28// ========================2930private table PlasmaBall_chargingFrames310, 8, 1, 9, 6, 7, 0, 8, 1, 9, 6, 7, 2, 3, 4, 532end table3334private table PlasmaBall_attackingFrames356, 1, 7, 136end table373839// ========================40// Events41// ========================4243event ObjectUpdate44switch object.state45case PLASMABALL_SETUP46object.frameTable = PlasmaBall_chargingFrames47object.animTimerMax = 6348object.animSpeed = 249object.xvel = object.targetPos.x50object.xvel -= object.xpos51object.xvel >>= 452object.state++53break5455case PLASMABALL_MOVETOPOS56if object.alpha < 19257object.alpha += 1658end if5960object.xpos += object.xvel61if object.xpos <= object.targetPos.x62object.timer = 18063object.state++64end if65break6667case PLASMABALL_CHARGING68object.timer--69if object.timer <= 070object.animationTimer = 071object.alpha = 12872object.frameTable = PlasmaBall_attackingFrames73object.animTimerMax = 774object.animSpeed = 175object.xvel = player[0].xpos76object.xvel -= object.xpos77object.xvel >>= 878object.yvel = 0x1400079object.timer = 13380object.state++81end if82break8384case PLASMABALL_ACTIVE85object.xpos += object.xvel86object.ypos += object.yvel87object.timer--88if object.timer <= 089object.type = TypeName[Blank Object]90end if91break9293end switch9495object.animationTimer++96object.animationTimer &= object.animTimerMax97temp0 = object.animationTimer98temp0 >>= object.animSpeed99GetTableValue(object.frame, temp0, object.frameTable)100101if object.frameTable == PlasmaBall_attackingFrames102foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)103BoxCollisionTest(C_TOUCH, object.entityPos, -12, -12, 12, 12, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)104if checkResult == true105CallFunction(Player_LightningHit)106end if107next108end if109end event110111112event ObjectDraw113if object.frameTable == PlasmaBall_attackingFrames114DrawSpriteXY(object.frame, object.xpos, object.ypos)115DrawSpriteFX(5, FX_INK, object.xpos, object.ypos)116else117DrawSpriteFX(object.frame, FX_INK, object.xpos, object.ypos)118end if119end event120121122event ObjectStartup123LoadSpriteSheet("SBZ/Objects.gif")124SpriteFrame(-16, -16, 32, 32, 2, 397)125SpriteFrame(-12, -12, 24, 24, 35, 397)126SpriteFrame(-5, -5, 10, 10, 60, 397)127SpriteFrame(-7, -7, 14, 14, 71, 397)128SpriteFrame(-8, -8, 16, 16, 86, 397)129SpriteFrame(-12, -12, 24, 24, 103, 397)130SpriteFrame(-7, -7, 14, 15, 128, 397)131SpriteFrame(-7, -7, 14, 15, 145, 397)132SpriteFrame(-16, -16, 32, 32, 2, 430)133SpriteFrame(-12, -12, 24, 24, 35, 430)134135// No Plasma Balls are even in the scene on startup...136foreach (TypeName[Plasma Ball], arrayPos0, ALL_ENTITIES)137object[arrayPos0].inkEffect = INK_ADD138object[arrayPos0].alpha = 0x80139next140end event141142143// ========================144// Editor Events145// ========================146147event RSDKDraw148DrawSprite(0)149end event150151152event RSDKLoad153LoadSpriteSheet("SBZ/Objects.gif")154SpriteFrame(-16, -16, 32, 32, 2, 397)155156SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")157end event158159160