RPG game engine production - map articles: oblique 45 degrees

xiaoxiao2021-03-04  52

A map of the map in the RPG game is important. It is a platform for game expansion. So I simplified the interface of the map using the map is very simple, inevitably too complicated to use the inconvenience.

Interface of the map: Set the map size, set the size of the map block, the map switches to the specified ID, generate a map according to the specified image and the size of the map block.

RPG Maps are generally multi-layered: background layer, shield, and events. The background layer is mainly drawn by the map scene based on the map block. The obstruction is mainly possible to generate an event, generating an object that occurs and blocks the relationship. The event is binding with the map area, and is actually binding the map block. Because the role is at different or all related detections when moving forward is related to the map block.

It is a simple event that is difficult to stitching here or the map of the map. The difficulty of stitching leads to the difficulty of map covering. Here is a description of these difficulties:

1 Map Splicker: Different in the row of 45 degrees, the row in the general sense, its line is a zigzag, first numbered the block on the line, the even number in the normal sense, while odd number It is drawn in an even diagonal 45 degree direction.

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 = 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 column col ; x = x halfw; y = y halfh; this.drawImage (this.tiles, g, x, y, 20);} }

2 Judgment of the occlusion: Because it is an oblique 45 degree perspective, the judge of the occlusion cannot be determined by 90 degrees, and simple x or y cannot be more in front, who is behind. If we draw a face before your own perspective, then a straight line with the map coordinate 45 degrees with the map, then this line is the basis for the comparison. Who is going to see this line from the predecessor. That is to see the value of B in x y = b. Ok, I will understand this. Another point is that when B is the same, you may have to see who Y is. OK, everyone should understand.

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

New Post(0)