(Translation) Win32ASM instance-2

zhaozj2021-02-16  44

2.0 - Design of The Game Game Design

Before get started with programming, we will design the game number.

Before we start programming, let's first design the game.

2.1 - Basic IDEA Basic Ideas

The Idea Is To Create A Simple Shuffle-Puzzle. An Image Is Divided in Tiles Which Are Mixed Up, The Goal of The Game Is To Shuffle The Tiles Into Place To Make The Image Appear:

That is to create a simple puzzle game. A picture is divided into a mess. The purpose of the game is to make the drawing appear by dragging the small blocks to the appropriate place:

2.2 - Tiles WINDOW Tile Window

The window with the tiles will be an ownerdrawn static control, ie it's a static control, it just displays something, but it is drawn by the program itself. A bitmap of 200 x 200 pixels is used for the tiles. First, the bitmap is loaded, then the 3D-borders that represent the tiles are drawn over the bitmap. When drawing the tiles, the program finds out which part (tile) of the bitmap should be displayed on a specific tile position, then copied to an image buffer ( the backbuffer). When all drawings are done, the backbuffer is copied to the static control and is displayed. The backbuffer prevents flickering when drawing the static control, because all drawing is first done invisible on the backbuffer, then the completed image is displayed on The Static Control.

The window containing the tile is a self-drawn static control, that is, a static control that is just displaying something but it is drawn by the program itself. A bitmap of a pair of 200 × 200 pixels is used as a tile. First, load bitmap. Then, on the top of the figure, the 3D edge representing the tile is drawn. At the time of the drawing block, a portion of the program has a portion of the graph should be displayed in which particular tile position. Then copy to the image cache. When all painting work is completed, Backbuffer is copied to a static control and displayed. BACKBUFFER prevents flashing when drawing static controls, because all painting work is darker in the backbuffer in the backbuffer. The complete image vegetables are then displayed on a static control.

2.3 - Tile Positions and Coordinates Tiles Location and Coordinate

The Program Uses Different Forms of Tile Positions and Coordinates.

Program uses different forms of block positions and coordinates

The Tiles Are Indexed Like this:

The icon number is as follows:

(When Playing The Game with Numbers INSTEING A Picture, They Are Numbered 1..16 of course) (Of course, their numbers are 1 ~ 16 when using numbers to play games

There are three coordinate systems for the tiles: one in tile coordinates (0,1,2,3), one in real screen coordinates, relative to the left topmost pixel of the image above, and one in the static control coordinates, which includes Margins to Display The Tiles in the center:

For the icon by three coordinate systems: one is the icon coordinates (0, 1, 2, 3), one is a real screen coordinate - relative to the most leftmost pixels of the image, and coordinates in static controls, This includes blank white in order to display the tiles in the center.

2.4 - Program Flow program process

The Basic Program Flow Will BE:

The basic procedure process is:

Display the Tiles

The Tiles Are Shuffled According to the Difficulty Level

One Tile Is Removed (Tile 16 At Tilepos 15) (OtherWise It Would Be Hard To shuffle :)

.................. ..

The Program Checks if The Tile Clicked On CAN Move (I.e. if The Empty Tile Is Surrounding The Clicked Tile)

IF not, IT Does Nothing

If Yes, IT FINDS OUTHOW MOVE TIES, DOES The Move and Updates The Static Control to Display To Display To Display To Display The Change

IT CHECKS IF The Puzzle IS Solved, IF Yes The Full Image IS Displayed and Statistics Are Shown.

A counter is incremented to count the number of moves the user has taken

A Timer Starts Running When To User Makes The First Move To Measure The Amount of Time The User Took To Solve The Game

1. Display block

2. According to the difficulty, the tile is disrupted.

3. A tile is removed (the sixteenth block of the block position 15) (otherwise it will be difficult to move :)

4. When a user clicks on a static control, a process is called to find out which piece of the user clicks.

5. The program checks if it is possible to move (i.e., whether there is a blank block around the tip of the tap)

6. If you can't, don't do anything

7. If you can move, it finds how to move the tile, make movement and update the static control to display changes. 8. It checks if the illustration is already unspeakable, if it is a complete picture on a static control

9. A counter for calculating the number of steps walking by the user.

10. When the user gets out of the first step, the timer starts to move the measurement user to solve the game how long.

转载请注明原文地址:https://www.9cbs.com/read-26620.html

New Post(0)