The angular angle has become a standard for the current RPG game, which is more won than the visual performance than the ordinary vertical perspective, but it also brought some inconvenience.
Let's talk about the spelling of the map. The map of RPG, war, and instant strategic games is still spelled with a piece of small icon (TILE), which is mainly in order to save memory, but the requirements for art will be higher. Moreover, the tile of the side is a rhombus, and the rectangular TILE tied to the vertical view is complex.
Suppose each of our map units (ie, a rectangle out of the red line frame in the figure below) is 32x16 pixels, then the size of this Tile is 32x15 pixels (such as the left), rather than 32x16 pixels. Because the width of the line in the junction is 0, it is actually a width. Pulling this TILE is like a picture below, just a rigid seam, the same TILE of each label is just 16 pixels.
Taking a judge of the bevel gant, this is the most important step in the game that uses mouse operations. In a strabismic angle game, because each Tile is diamond, it is necessary to determine that the location of the cursor is in the position of the vertical perspective, which can be done. Arrange the Tile's labels, blue and yellow represent different rows, but the location of the same tiles is the same, of course, there will be some waste, this is also no way. Then the entire screen (assuming the screen size is the size of the right picture, but there is a point to pay attention, it is to pay attention to the top left corner point of the screen, it is best to be a Tile center point, turn the upper left corner center relative to the main map Tile [0,0] The center position is [Origin_x, Origin_Y]) According to the size of the Tile into the MXN block rectangular area (such as a box method of the right picture red line), add the cursor on the screen [Origin_x, Origin_Y], it will get the cursor. The location on the entire map. Judging which rectangular area is in the rectangular area of the mouse, you know the position of the center of the rectangular area, and the location of the center point of this Tile is known.
The following is a geometric problem, which is the equation of the coordinates of the coordinates of the diamonds of KX, Ky, respectively, the interior of the X-axis and Y-axis intercepts. I should know, that is,: KY | X | KX | Y | If the cursor is not in the central TILE, then determine the offset of the cursor relative to the center of the rectangular area. It is easy to determine the cursor in the adjacent point according to the positive and negative of the value. Here is the source code for judging the position of the cursor. Where PX, PY is the position of the cursor on a large map, MX, My is the location of the Tile (here is calculated by each TILE size). #define abs (x) ((x)> = (px & 63) -15; ky = (py & 31) -15; mx = px >> 6; my = py >> 5; CX = ABS (kx); CY = ABS (KY); MX = MX * 2 1; // Tile of the Tile of the Rectangular Area is odd IF (CX 2 * cy> = 32) {IF (kx> 0) IF (ky> 0) MX , MY ; ELSE MX ; Else IF (KY <0) MX -; Else MX -, my ;} About the values of the angular angle game temporarily talk about it first, next time you see.