Maps in the game are virtual scenarios of the entire game. Generally, game maps on mobile phones can be divided into the following three types by screen scrolling: 1) Vertical scroll The most common is aircraft-hitting games, where screen scrolling mainly simulates aircraft that are flying at regular speeds from top to bottom. Relatively complex games also support horizontal and left scrolling to a certain extent. 2) Horizontal scrolling ArpgGame, the main foot through the screen from the left to the right to explore the unknown world, destroy the enemy, successful pass. Relatively complex games also support up and down screen scrolling to a certain extent. For example, "Soldado" and "Super Mary. 3) Vertical and horizontal scrolling RPGThis is the most common situation in games. A key task of the main character is to explore a large unknown field: discovering enemies, discovering special locations, buildings, and so on. In either scenario, the following problems are involved: 1. Move Position Control: when the main character moves in the map, the obstacles to the objects in the map must be taken into account. The main character cannot cross the wall and must cross the river through the wooden bridge. A more realistic simulation requires the protagonist to move at different speeds on different ground: the land speed is average, the snow is slippery, the movement is fast, and the Stop effect is lagging. 2. Dynamic map changes: the behavior of the protagonist in the game results in map changes. The changes mentioned here are permanent rather than temporary (for example, the decay and fading of the enemy's bodies do not involve modifying the map ). For example, destroying enemy buildings, building our buildings, and building roads. It can be seen that the main function of map programming in the game is: 1) How to display a large map scenario. 2) How to restrict the movement of game protagonists and enemies by MAP: Block Movement and modify motion effects. 3) How to dynamically change the display content of a local map. Starting from this chapter, we will explainCocos2d-iPhoneThe engine provides the following map processing mechanisms:Tiled maps. As a still developing and mature game graphics engine,TmxIs currently the main supported map format. OriginalPguThe format is no longer the focus of our explanation. Map editor Basic knowledge Considering the memory usage, running efficiency, and image display restrictions,IPhoneThe on-game maps are composed of several small "tiles ".Tile. For example: This figure is actually composed of the following:3Composed: In this way, a large map can be implemented only through a few image elements, greatly reducing memory usage and improving game operation efficiency. Of course, this requires that we need some artistic "cells" when creating a map ",ProgramNormally, the following works seem rigid and not vivid :(Http://wiki.themanaworld.org/index.php/Mapping_Tutorial) Slightly adjusted: In this way, I feel much better. In fact, I feel that I am not at this level. Let's look for a helper. You will certainly have something around you, for example, the person who is angry when he sees you go home and lie in front of the computer. Slave0.8.1The version starts.TiledThe Map edited by the visual map editorIPhoneOn the screen.Cocos2d-iPhoneProvides built-inCctmxtiledmapDisplays maps and dynamically modifies maps. TiledThe main site of is:Http://mapeditor.org/index.html. This is an open-sourceJavaTool.QtVersionWind32Directly run onEXEFile. We recommend that you useJavaVersion, installJavaThe latest running environment (Http://java.com/zh_CN/download/manual.jsp). The reason is:QtIt lacks important functions. This tool is very simple and similarWindowsThe only difference between the built-in "paint brush" program is:WindowsThe minimum image unit of the "paint brush" program is a pixel, whileTiledThe smallest unit is a "tile ". Generally, we recommend that the "tile" have the same length and width, and the size is2. (This is to make the imageIPhoneIt has the lowest memory usage and the best running efficiency) Good English friends can get a detailed description of the tool directly from the tool's main site and link website. The author selects the most important content for everyone to grasp as soon as possible. ... If you are interested in this article, you can download the complete PDF here. Download the sample source code. |