manhattansoli.blogg.se

Minesweeper difficulty
Minesweeper difficulty













minesweeper difficulty
  1. #MINESWEEPER DIFFICULTY MOVIE#
  2. #MINESWEEPER DIFFICULTY WINDOWS#

  • board: Sprite object containing the whole board that will contain all of the zone objects.
  • save it as Main.as, link it to the Flash file as the document class and let's dive into the code.įirstly: we will start the class by extending the Sprite class, importing the classes that we will need - in this case we will import & - and defining some variables as follows:

    minesweeper difficulty

  • highlight_mc: a simple movieclip with a radial gradient for the hover effect.Ĭreate a new class and call it Main.
  • num_txt: a text field to display the number of mines in the surrounding zones.
  • bomb_mc: a simple graphic to appear when the zone is marked as containing a mine.
  • It's just a 40x40 square with a bevel effect on it.
  • block_mc: the graphic for the zone object before it's revealed (opened).
  • this zone object consists of the following:

    minesweeper difficulty

    This symbol will be linked to the Zone class that we will create later to add the zone functionality, and is set to be 40x40 pixels.

    #MINESWEEPER DIFFICULTY MOVIE#

    In addition to that, the library contains another symbol called zone - it's the movie clip representing the Zone object.

  • minesleft_txt: the textbox that displays the number of mines left.
  • gameover_mc: movie clip that contains the graphic for the Game Over screen.
  • or you can start with the FLA included in the source download.įirst: there are three objects on the stage: Note: you can start from scratch creating a new. The Flash file contains the graphical elements only for the game. Let's take a look at the FLA that we will be working with. I recommend that you check them out in the documentation help for the MouseEvent class if you don't already know them. there are a bunch of other properties for some special keyboard keys like the Alt (for windows), Option (for mac), and the Ctrl (Command) key. I made it by detecting the shift key, and found that the easiest way to do that is by using the shiftKey property for the MouseEvent class. The solution that I came up with is through using the keyboard. If you were to publish the game as an AIR application, then you would have access to all of the mouse features including the right and middle mouse buttons, and you should do that for better user experience while playing the game.īut if you want to publish the game via Flash Player in the browser, then you don't have access to the right mouse button, since the right mouse button will open the context menu for the Flash Player so we have to figure out a solution for this problem. there will be a Zone class linked with a zone movie clip in the library, and we will instantiate the amount of zones we need from our main class to make the game board.Īddressing the Right-Click Problem within Flashįor a regular minesweeper game - a native one that's not in the browser - you can have access to both mouse buttons, so that the user playing the game can open regions by left clicking and mark them by right clicking.
  • ycor: the vertical position of the zone in the board.Īnd that's how we will build the game.
  • xcor: the horizontal position of the zone in the board.
  • zoneValue: the number written inside the zone representing the number of mines in the surrounding zones.
  • marked: whether the user has marked the zone as containing a mine.
  • revealed: if it's revealed, the user has opened the zone.
  • state: whether it contains a mine or not.
  • We will call this object a 'zone', and all of the game zones will be in a container object that we will call the 'board'.įor every zone object, there is a bunch of properties like: In a minesweeper game, if we want to think of the game from the OOP point of view, we can consider each region as an object. Otherwise, play the game from the final SWF file, embedded above.

    #MINESWEEPER DIFFICULTY WINDOWS#

    So, when starting your game, your first few clicks will depend on your luck to find mine-free regions, but once you open a fair amount of regions, you can use logic to find the regions that contain mines.Ī good example for a minesweeper game, is the one that ships with Windows (any version) a simple search for will also direct you to several versions, which all have the same concept. The key for determining whether a certain region contains a mine or not is that for every 3x3 grid (9 regions) of squares, the number written on the region in the center represents the number of mines in the 8 other surrounding regions. You open the region by left-clicking it, and mark a region by shift-clicking. Your mission is to reveal (or "open") all the mine-free regions and mark the ones that contain mines. Each region either contains a mine or not. Minesweeper game consists of a group of squares where each square represents a region. If you're a minesweeper player, then probably you know the game rules - but just in case you're not: Because Flash Player doesn't support right-click, shift-click on the squares you think contain mines in order to mark them.















    Minesweeper difficulty