//--------------------------------------------------------------------------------------------- // Name : takeSpecialAction // Object : Blocks // // Arguments : type - the kind of special block (see globals.cs) // : position - the coordinate location of the block // : player - the player this block will affect (sometimes the opposite) // : iteration - used to track multiple instances of this call for a single special block // // Description : based on the type of block, decides what action is to be carried out //--------------------------------------------------------------------------------------------- function Blocks::takeSpecialAction(%this, %type, %position, %player, %iteration) { if (%type == $SPECIAL_BLOCK_CLIP) { // which player? if (%player == $PLAYER_ONE) %clipColumn = $P2_CLIP_COLUMN; else %clipColumn = $P1_CLIP_COLUMN; // destroy the next block in the clip %block = bbSceneGraph.pickPoint(%clipColumn, $P_CLIP_TOP + ($BLOCK_SIZE * %iteration), BIT(0), BIT($BLOCK_LAYER)); if (isObject(%block)) { Player.changeKillCount(%player, 1); eval("alxPlay(sfxBlockExplosion" @ getRandom(1, 3) @ ");"); %explosion = new t2dAnimatedSprite() { config = "playfieldBlockExplodeConfig"; }; %explosion.setPosition(%clipColumn, $P_CLIP_TOP + ($BLOCK_SIZE * %iteration)); %block.safeDelete(); } // keep going till we reach the end of the clip if (%iteration < $MAX_CLIP_COUNT) %this.schedule(mFloor(1000 / $MAX_CLIP_COUNT), "takeSpecialAction", %type, %position, %player, %iteration++); } } // end takeSpecialAction