Making the player see what happened

To get a playable game you just need to wait a second after the player picked the second tile before removing/covering them.

This can be done by adding a timer in the game. Timer class included in flash.utils package will let us use timers, and TimerEvent class included in flash.events handles timer events.

Let's start importing the classes and declaring a new variable. Change your script until Main function looks like this:

package { // importing classes import flash.display.Sprite; import flash.events.MouseEvent; import flash.events.TimerEvent; import flash.utils.Timer; // end of importing classes public class Main extends Sprite { private var pickedTiles:Array = new Array(); private const NUMBER_OF_TILES:uint=20; ...

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.