Moving the balance

At this time we should feature a fulcrum simulation. There's some physics concepts you should know, try to google for "fulcrum" to know more information.

We aren't looking for a complete simulation of a fulcrum, so multiplying the weight of the spheres by the distance, in columns, from the center will be enough. I won't care about row position in this script; anyway you are free to do it if you think this can improve the quality of the game.

At the end of onEnterFrm function after the switch statement add this code:

private function onEnterFrm(e:Event):void { switch (gameStatus) { ... } var weight:int=0; for (i=0; i<6; i++) { for (j=0; j<8; j++) { if (gameArray[i][j]!=0) { var tmpBall:ball_mc; tmpBall=balance.getChildByName(i+"_"+j) ...

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.