lkpsmooth.blogg.se

Java code for minesweeper game
Java code for minesweeper game







java code for minesweeper game

The explosion starts by explode function. It consists from 39 frames, which are drawn into table cell in _drawUncovered method. Mine explosion is a simple animation of explosion under water. draw animation if the cell is animatedĬanvas.drawBitmapNine(, this.width / - 2, this.width / - 2, this.width / 2, this.width / 2) Ĭanvas.drawPath(, ) Ĭanvas.drawText( " 1", / - 2, / 2, ) Ĭanvas.drawText( " 2", / - 2, / 2, ) Ĭanvas.drawText( " 3", / - 2, / 2, ) Ĭanvas.drawText( this._state.toString(), / - 2, / 2, ) Appearance for every different situation is drawn by separate functionsĬopy Code function _drawUncovered(canvas)Ĭanvas.drawRoundRect( this.width / - 2, this.width / - 2, this.width / 2, this.width / 2, this.width / 10, this.width / 10, ) Ĭanvas.drawRoundRect( this.width / - 2, this.width / - 2, this.width / 2, this.width / 2, this.width / 10, this.width / 10, ) The cell has many different appearances in different situations (covered cell, uncovered cell, marked cell etc.). This class has property state, which says how many mines are in neighbour cells, otherwise it is labeled with -1 and then that particular cell contains a mine. Table cellĪll cells in the table are created as an instance of MineCell class. The main part of our game is gameScene, which is for table of mines, and includes menu layer for menu buttons. We used Moscrif game framework to create this game. This explosion is created from about 40 frames to create really smooth animations

java code for minesweeper game

When user finds a mine all mines in the table explode.

  • uncovered cell with zero mines in neighbour cells.
  • Every cell of this table has few different designs: It is similar to beginner’s level in Microsoft Windows version of this game. The mines table has nine rows and nine columns and contains ten mines. The main pros of using vector graphics are that they maintain all details when they are resized and their sizes are smaller. The whole user interface is created using vector graphics. After user loses or wins the game, menu drops down and shows ending message and time.

    java code for minesweeper game

    It consists only from a table with mines, timer, mines counter and menu. Supported platforms are iOS, Android and Bada. Thanks to object-oriented JavaScript used as its native language, development is easy fast and cheap. To overcome platform differences, we will use Moscrif SDK. Since we are developing this game cross-platform, it could be played on Apple iOS, Android and Bada devices. In this article, we are going to show you how to create this game for smartphones. The game has been made for many platforms. The objective of the game is to clear an abstract minefield without detonating a mine. Minesweeper is a classic game, known from the Microsoft Windows OS. Download Minesweeper-emulator.zip - 2 MB.









    Java code for minesweeper game