Stacking spheres

When the player forms a chain of three or more spheres of the same color, they must disappear. Throughout this book you learned how to manage adjacent tiles in tile-based games a lot of times, in a lot of different ways. I'm showing you another way, just to make you understand how the same things can be made in a lot of ways when you know a language.

We'll start adding a new class level variable called chainArray that is the array that will contain the chains.

private var balance:balance_mc=new balance_mc();
private var gameArray:Array;
private var chainArray:Array;
private var ball:ball_mc;
private var selCol:int;
private var selRow:int;
private var gameStatus:String="placing";

With this new variable, we can code the checking ...

Get Flash Game Development by Example now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.