Showing tile contents

Once the player clicks on a tile, no matter its type, he/she must be able to see its content.

The idea: Once the mouse click listener has been triggered, the clicked tile will react this way:

  • show frame 3 if it's a mine.
  • show frame 2 and change the text according to the number of surrounding mines if it's not a mine.
  • show frame 2 and display no text if it's not a mine and there aren't adjacent tiles with a mine.

And, for all cases, remove the listener. A tile can be clicked only once.

The development: Rewrite onTileClicked function this way:

private function onTileClicked(e:MouseEvent):void { var clicked_tile:tile_movieclip=e.currentTarget as tile_movieclip; clicked_tile.removeEventListener(MouseEvent.CLICK,onTileClicked); clicked_tile.buttonMode=false; ...

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.