Home > Articles > Web Design & Development > Other

  • Print
  • + Share This
  • 💬 Discuss

Modifying the Game

A few more tiny changes before we are done with the game.

First, when we recenter all the cards, it throws off the horizontal and vertical offsets for the card placement, so that needs to be readjusted:

private static const boardOffsetX:Number = 145;
private static const boardOffsetY:Number = 70;

How did I come up with those numbers? Well, if you really want to know:

  • The stage is 550 pixels across. There are 6 cards, each spaced 52 pixels apart. That's 550-6*52 for the total space remaining on the left and the right. Divide by 2 to get the space to the right. However, the cards are centered at 0,0, so I need to subtract half of the width of a card, or 26. So, (550-6*52)/2-26=145;
  • Same for the vertical offset: (400-6*52)/2-26=70;

Another loose end to consider is the cursor. When users go to click a card, they don't get a special "I can click this" cursor. That is easily changed by setting the buttonMode property of each card as it is created:

c.buttonMode = true;

Now, we have a finger cursor when the user rolls over the cards. This is the case for the Play and Play Again buttons because those are Button symbols.

One last change I made is to increase the frame rate of the movie from the default 12 frames per second to 60. You can do this by choosing Modify, Document to change the main movie document properties.

At 60 frames per second, the flips are much smoother. With the super-fast ActionScript 3.0 engine, even slow machines can run this game at this high frame rate.

That wraps up the matching game, leaving us with the final version files:

   MatchingGame10.fla

   MatchingGameObject10.as

   Card10.as
  • + Share This
  • 🔖 Save To Your Account

Discussions

comments powered by Disqus