No sudden death

There is still the "sudden death" issue, that happens when the player makes their first click on a mine. This must be prevented.

The idea: Avoiding sudden death is simple: just create the mine field after the player clicked on the first tile, setting such a tile as an empty one.

The development: The development of this feature does not introduce anything new, so you should be able to figure out by yourself how it works. I just cut/pasted some code from main to onTileClicked function.

This is how class level variables block changes:

// class level variables
private var firstClick:Boolean=true;
// end of class level variables

Main function now does not fill mineField array with mines and digits:

public function Main() { // mine ...

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.