I haven't updated my blog for a while. I have been busy with projects recently. I will share my latest achievements with you.
Recently, we have been combining research and development tools with game production. We all know that we must first sharpen the tool for good work. A good and convenient development tool can greatly improve the game development efficiency, this is why there are so many development engine tools abroad, especially 3D, such as unity3d, unreal, cryengine and so on are developed based on this requirement.
My new blog series will teach you how to use the tilemap map editor to improve your efficiency in creating 2D maps.
Here I may mainly introduce some advanced usage. If you are not clear about some basic usage of the 2D map editor, go to Baidu and check the information.
Next, let's go to the topic. First, provide the tilemap
Http://www.mapeditor.org/
Tilemap is an open-source map editor developed using QT. Therefore, it can be cross-platform. Because it is open-source, you can also process and modify it as needed. This is very important.
The following is a question for those who are new to game development. Why do we need to develop a map editor? Can we just use the whole map for map?
There are two advantages: www.it165.net.
The first one is to greatly reduce the area of the image, which reduces the memory occupied by the system during runtime. The specific principle is to ask your boss or du Niang.
The second advantage is that you can easily make a lot of events in the grid through a scattered map to facilitate judgment. For example, you can make a map obstacle judgment and trigger event judgment.
After the download and installation, open the editor as follows.
Click Create map. The following box is displayed.
You can select "normal" or "45 degrees" for the map direction of the editor. This is a feature not available in many other editors. Most editors only support single-direction map editing, this is why I chose tilemap editor for development.
The map size indicates the number of map grids. If the value is 30*30, a total of 900 grids are displayed.
The block size on the right indicates the size of a single grid. Here it is 64*32. Generally, the size of the square map block is the same. Here we use 32*32.
After confirming, as shown in figure
Next we will add image resources
Click "map"-> New Graph block. The following dialog box is displayed.
Click "Browse" button to select a picture, here we use the cocos2d-x inside the representative picture, the path is as follows
Cocos2d-2.0-x-2.0.2 \ samples \ testcpp \ resources \ tilemaps \ tmw_desert_spacing.png
Here, the block width and height are 32, indicating the margin and spacing,
Margin refers to the horizontal interval between two blocks.
Spacing refers to the vertical interval between two blocks.
We can see that there are a lot of black lines on the image. Generally, the blocks we made earlier do not have these intervals, but there may be special circumstances, so now we have met, so now, if we do not add any margin or spacing, the cut block will be faulty.
As you can see, I have not set the margin and margin to cut out the image blocks, and there will be more and more pixels with obvious deviations,
Next, we will delete this image block and then add it again.
Click the "recycle bin" button under the image block to delete the image block.
Next let's take a look at setting the margin spacing. Here we set it to 1 pixel.
Now, we can see that the white lines separated by the block have completely covered the black lines on the image. This shows that our settings are correct. We can use the block to splice a map.
This row is a tool button. The first three buttons are usually used for map creation.
The first is the image stamp, a single brush, or a rectangular image block. Use this tool.
The second is filling,
The third is the eraser.
When you try it, you will know how to use it. Remember, you can use the mouse to select a rectangular graph block at a time on the block layer, then, you can easily and quickly use the first stamp.
All right, let's practice it all.
Click "file"> "Save as" to export the file.
Here are some tips:
Select the image block and press the keyboard's "X" shortcut key to flip the block horizontally, while "Y" is vertical,
The "Z" key can be rotated 90 degrees. Very practical.
There is also a random button
This button is used after being elected
Then select a large map in the map block box. At this time, when you draw a map, you will randomly select a map from many of the selected map blocks. The effect is as follows:
In addition, all commands in tilemap can be found here.
Https://github.com/bjorn/tiled/wiki/Keyboard-Shortcuts
Now you should know the importance of learning English well.
This article is from the "Dairy" blog