The map occupies an important part of the RPG game. It is the platform for the game to unfold. So I am very simple to use the interface of the map, it must be too complex to bring the inconvenience of use.
Map interface: Sets the map size, sets the size of the map block, maps the scene to the specified ID, and generates a map based on the size of the specified picture and map block.
RPG maps are generally multi-layered: background layers, occlusion objects, and events. The background layer is mainly based on map blocks for map scene drawing. The occlusion is mainly an object that can occur, which will cause the occlusion and blocking relationship. An event is bound to a map area and is actually a map block. All relevant detections are related to the map block because the character is not moving or when it is moving forward.
Here the difficulty may also be the map splicing, the map drawing is very simple event. And the difficulty of stitching leads to the difficulty of map occlusion. Here are some of the difficulties to do a description:
1 map splicing: In the oblique 45 degrees of the map line and the general meaning of the row, its line is jagged, first the number of blocks on the line, even in the normal sense of the order position, and the odd is in the even oblique 45 degrees direction to draw.
Startcol = g.getclipx ()/20;endcol = (g.getclipx () +g.getclipwidth ())/20 + 2; StartRow = g.getclipy ()/20;endrow = (g.getclipy () + (TMP = G.getclipheight ()))/20 + 2; for (int row = startRow-1; row < Endrow; row++) { y = row*tileheight; i = 0; if (Row < 0 | | row >= this.grid[0].length) continue; for (int col = ((startCol-1) <<1); col < (endcol<<1); col++) { if (Col < 0| | Col >= This.grid.length) continue; x = (col>>1) * this.tilewidth; y = row * this.tileheight; This.drawcell (g, X, Y, col, Row); This.drawimage (this.tiles,g,x,y,20); Draw Odd Series col++; x = x + HALFW; y = y+ halfh; This.drawimage (this.tiles,g,x,y,20); } } |
2 occlusion judgment: because it is oblique 45 degrees angle of view, so the judgment of occlusion can not be based on 90 degrees of judgment, simple x or y can not compare who in front, who in the post. If we draw a slice in front of our own perspective, then the intersection with the map will appear a line 45 degrees from the map coordinates, then this line is the basis for our comparison. Who before who should look at this line who is far from the pre-origin point. That is to see the value of B in the x+y=b size. Well, it's time to get this right. Another thing is that when B is at the same time, it's possible to see who has a big Y. OK, everyone should understand.