Facebook is becoming very popular and bringing more advanced options every month and attracting the members.  I like mindjolt facebook application and i enjoyed almost all the games. Tower Stacker is one of game i like the most from mindjolt. That game is a simple game and a very interesting game too. So, I planned to create the same game in AS3. I know that game needs some math functions like "atan2" to swing the holder.
Objective of this game:
  1. Holder should pick a new tower ball and start to swing
  2. Holder should place the ball on the selected location
  3. Again a new ball will be generated and started swing. If the recent ball placed on the line of the previous ball, the ball is on the stack or it will fall down from the stack.
  4. The score is based on the exact location of the recent ball with the last ball placed on the stack.
To swing the holder every time right after picking the new ball, we need pythagoras theorem, atan2(x1-x2)*degrees/PI, this will swing the holder one time, to make it oscillate I have to detect two x positions for start and end and need decrease/increase the speed of the oscillation based on the direction like,

rope_mc.rotation=Math.atan2(rope_mc.x-xSpeed,ySpeed)*90/Math.PI;

to make it swing, I am multiplying the speed with -1 on each swing like,

if (holderStatus=="swing") {
                if (xSpeed>=540||xSpeed<=50) {
                    speed*=-1;
                }
                xSpeed+=speed;
}

Now I should drop the ball on each mouse click, and placed the ball on stack based on some conditions. I used a separate movieclip to have the base of the stack and to add the balls each time on mouse click. From the second ball, each ball will be placed on the stack only if it is hit the previous one in a least best position. The score will be calculated based on the position it placed on the stack.
You like it? Let me come with some other game soon.
And
12/9/2010 07:04:22 pm

It's buggy in IE8 on xp Pro.
Get over 2 in a stack and the crane stops swinging.

Reply
Arun
12/14/2010 09:37:32 pm

@And,

thanks for your comment. I will fix it ASAP.

Reply
8/15/2012 05:41:22 pm

Its been wow reading your article. I would like to jump on this site again.Thanks..

Reply
10/9/2012 08:59:04 pm

Firstly thanks a lot for such a wonderful post. I would like to know more about such topics and hope to get some more helpful information from your blog. C U soon.

Reply



Leave a Reply.