⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mapwin.htm

📁 J2ME手机游戏开发中地图生成软件 可以将地图以数组形式输出
💻 HTM
📖 第 1 页 / 共 5 页
字号:
(this is shown in the Map Editor window), the elements in that
are short int offsets to either <font color="#FF0000">Block
Structures</font> if they are positive, or <font color="#FF0000">Anim
Structures </font>if they are negative, <font color="#FF0000">Anim
Structures</font> contain offsets to <font color="#FF0000">Block
Structures</font>, <font color="#FF0000">Block Structures</font>
have 4 offsets to the <font color="#FF0000">Graphics Blocks</font>
(amongst other things).</p>

<p>MapArray ------&gt; Block Structures --------&gt; Graphics Blocks<br>
......\............................/<br>
........\Anim Structures/</p>

<p>&nbsp; That's about as much as you need to know if you don't
intend adding your own objects, linked lists etc and are going to
use the playback libraries.</p>

<p><a href="#topod">(top of doc)</a> </p>

<hr>

<p><a name="imgfmts"></a></p>

<h3>Supported image formats (BMP, PCX, PNG, TGA)</h3>

<p>&nbsp;MappyWin32 can import the following graphic formats:<br><br>
8bit (paletted) maps:<br>
<strong>BMP</strong> - 8bit (uncompressed)<br>
<strong>PCX</strong> - 8bit<br>
<strong>PNG</strong> - 4bit and 8bit (4bit is converted to 8bit on importing)<br>
<strong>TGA</strong> - 8bit<br>
Transparency is by a nominated palette index in MapTools:Map Properties<br><br>
<br>
15/16/24/32bit (truecolour) maps (graphics are converted to the map depth on importing):<br>
<strong>BMP</strong> - 8bit (uncompressed) and 24bit<br>
<strong>PCX</strong> - 8bit and 24bit<br>
<strong>PNG</strong> - 4bit, 8bit, 24bit, 32bit<br>
<strong>TGA</strong> - 8bit, 24bit, 32bit (with alpha on 32bit maps)<br>
Transparency is by a nominated RGB value in MapTools:Map Properties<br><br>

&nbsp;Alpha channel is only supported in 32bit maps, and where a playback 
library supports it (eg: MappyGL). Alpha channel is not shown in MappyWin32.<br>
<br>
&nbsp;To use PNG format, two extra files are needed, <strong>libpng12.dll</strong> 
and <strong>zlib.dll</strong>. These are available from the tilemap.co.uk site 
and many other places and should be placed in the same folder as mapwin.exe.<br>
<br>
&nbsp;When loading a MAP format map file, PNG and TGA are not supported. If you 
need to use PNG or TGA with a MAP, either save the MAP from a FMP map, or 
just keep a copy of your tile graphics in BMP or PCX format.
</p>
<p><a href="#topod">(top of doc)</a> </p>

<hr>

<p><a name="simple"></a></p>

<h3>Using Mappy as a simple map editor (.MAP format)</h3>

<p>&nbsp; Mappy is designed for creating and editing FMP maps, these have all
the features listed in the <a href="#features">features</a> section, and this
is the format supported by the playback libraries. However, sometimes you may
want to use a simpler format, and in Mappy this is MAP.<br><br>
&nbsp; New in version 1.2 of MappyWin32 is the ability to edit
'simple' maps. These maps lose nearly all the features of FMP, but
you can use them without a playback library, often with the built-in
functions of other packages. These maps have the .MAP extension,
rather than .FMP, and only contain the width and height of the map array
(optional) and the map array itself in a format of your choosing. When editing
a MAP you should not use features of Mappy that can't be saved in a .MAP
(such as animated blocks and block properties) as these will be lost
on exit. To configure the format of the .MAP files see the
<a href="#mapform">MAP format</a> section.<br><br>
&nbsp; To create a new simple MAP, ensure you have set the correct format (see
<a href="#mapini">mapwin.ini</a>) and use New Map from the File menu. Next,
select Import from the File menu, and choose your image file with the blocks in. 
You can now edit the map. To save a
MAP rather than a FMP, simply select 'Save as' from the
File menu, but type the name to save with a .map extension, for example
<strong>level1.map</strong> you will be notified you are saving a MAP. That's it!
You can now use the 'Save' option to save your map with the same name. Please
note that if you have a negative adjustment when you save the map, any blocks
that would be made negative become 0, for example, with -1 adjustment, block 0
will not change on save, all others will become 1 less. On load, all become +1
so there will be no block 0. This may sound confusing, but really it just means
block 0 will become block 1 so don't be surprised when you reload the map (block
0 is not valid with -1 adjustment) try it and you'll see... If you want to avoid
such confusion, simply fill the map with block 1 at the start.<br>
<br>
&nbsp; Using the .map format you can create files compatible with CDXMap, CDXIsoMap,
and many other custom formats.<br><br>
&nbsp; To load a .MAP, simply select Open from the File menu and open it. For the
tiles, Mappy will try to load the mapdefBMP specified in mapwin.ini, if that
doesn't exist, it will try the map name with a .BMP extension (so
<strong>level1.map</strong> will try <strong>level1.bmp</strong> in the same folder),
if these don't exist it will ask you for a BMP file to use.<br>
<br>
&nbsp; Most of the rest of this documentation is to do with FMP files, which have
much more advanced features, so if you are just doing a MAP they are not relevant. 
You can save a FMP as a MAP and a MAP as a FMP by changing the name when you 
'Save As'. MAP files can't store all the information from FMP maps, so this 
conversion may not be useful for complex FMP maps.<br>
<br>
&nbsp; If neither .MAP or .FMP are suitable, you can write a 
<a href="#cstmmenu">lua script</a> to import and export data in a custom format.<br>
</p>

<p><a href="#topod">(top of doc)</a> </p>

<hr>

<p><a name="isohex"></a></p>

<h3>Important information about FMP1.0, Isometric/Hexagonal/other maps</h3>

<strong>FMP1.0</strong><br>
<p>&nbsp; The difference between this and the older FMP format is that this
allows up to 30000 blocks, rather than 1024. Also, wherever a value was saved
as a byte offset, it is now a 'unit' offset. The downside is you need a playback
library that supports FMP1.0. You can freely change between FMP versions in
MapTools&gt;Map Properties as long as you have 1024 blocks or fewer.
</p><br><br>
<strong>Isometric/Hexagonal/other maps</strong><br>
<p>&nbsp; This is a new feature added in version 1.3 of MappyWin32. If you are
making a map with non-rectangular tiles there are a few things you should be
aware of. Firstly, they are always drawn transparently (obviously), so if you use
block 0, this will leave trails when you scroll in Anim Preview or a playback library, so
it is best not to use block 0, fill the map with block 1 at the start. Next, you will need a playback
library that supports FMP1.0 (this should be clearly stated in the playback library),
even though you can save as FMP0.5. The 'clickmask' MUST be set in MapTools&gt;Map Properties.
This should be the number of the graphic to detect transparent areas which allows the
editor to let you click tiles pixel-perfectly, normally 1 or 2. If you are editing a
.MAP rather than a .FMP, you should set the values correctly in
<a href="#mapini">mapwin.ini</a> for stagger and clickmask. The Block Parallax
functions are not supported. Non-rectangular tiles also take longer to draw.<br><br>
&nbsp;
As from version 1.3.1 Mappy now supports true isometric. This means that you can have
scenery that appears to rise out of the ground, and will be properly depth sorted
with both other scenery and sprites etc you may have in your game. In order to do
this, there is now a new mode which you must set by selecting MapTools:Riser mode.
To make a pillar you must first create a new block (Ctrl+N),
then select a BG graphic as usual, but the FG fields now work differently.
FG1 will overlay BG, FG2 will appear immediately above FG1, and the FG3 will
appear above FG2 (rather than overlaying it). What's that? It's not tall enough?
That's OK you can create a chain of blocks to stack on top of each other which
will be treated as just one pillar. To do this, simply check the left most of
the three 'other' boxes and the following block will be used to continue the
pillar. Any blocks which are attached will treat BG as an FG field. Attached blocks
will have a red border in the Blocks window (if Grid is on), indicating you
shouldn't use them directly.<br><br>
Isometric can be quite tricky to do, so I'd recommend looking up some information
about it on the 'net. Not all block sizes tile properly, 64x31 with block gap
64x32 and block stagger 32x16 works well. I'll probably do a proper Mappy
Tutorial for Isometric at some point in the future...<br><br>
Version 1.3.6 now allows you to draw the left or right half of pillars by checking
the 2nd (for left) or 3rd (for right) boxes of the 'Others' in block properties.
See iso_lr.fmp for an example, and iso_lr.bmp (in maps) to see the graphics I used.
This is common for isometric as it vastly reduces overlapping.
Also in 1.3.6 you can now specify a 'picklayer' in <a href="#mapini">mapwin.ini</a>
to allow easier picking of pillars (the blocks window is a bit confusing). Create
the picklayer just like a normal layer (in layers menu) and place your pillars on it.
Change back to your original layer, then just
press 'o' (the letter, not zero) to toggle between current layer and picklayer, move
mouse to base of pillar you want then press 'p', then 'o' again to return.<br><br>
I added Isometric to MappyWin32 as it was requested and easy to do, however there
are a couple of things which may be worth noting, and if they are a problem, you
should perhaps try a different isometric editor. The first is that the isomaps
are stored staggered, rather than the more common and easier to use rotated diamond
shape maps which means pathfinding etc in games is trickier to implement. You 
could write a lua script to save as a diamond shape map. The 
second is that the pillars are made out of block sized parts.

</p>

<p><a href="#topod">(top of doc)</a> </p>

<hr>

<p><a name="hexhlp"></a></p>
<p>
Here is some brief information on using the staggered row maps produced by Mappy.
A staggered row map has all the odd rows offset by an x and y stagger value which
allows you to make hexagonal and isometric maps. This document is most helpful
if you are using a 'sprite array' see Mappy Tutorial 1, or the isometric examples
in MappyAL or MappyDX for more info on sprite arrays.<br><br>

<h3>Hexagonal</h3>
<p>
First, hex maps, here is a diagram
showing how to get to an adjacent hex from a hex at x, y (block coords, as shown in
Mappy's titlebar). There are two diagrams, use whichever your hexes resemble:<br><br>
<img src="images/hexdiag1.gif"><br><br>
So, to get from x, y to the adjacent hex to the right and above, use a bit of code
like this:<br><br>
<strong>
int a = 1-(y&amp;1);<br>
x = (x-a)+1;<br>
y = y-1;<br><br>
</strong>
To convert your block coords to pixel coords, use:<br><br>
<strong>
px = x*mapblockgapx;<br>
py = (y/2)*mapblockgapy;<br>
if (!(y&amp;1)) {    //an even (not staggered) row<br>
// start of the map (0,0)  is offset by the stagger values<br>
	 px -= mapblockstaggerx;<br>
	 py -= mapblockstaggery;<br>
}<br>
px += mapblockwidth/2;    // centre of block<br>
py += mapblockheight/2;<br><br>
</strong>

So now if you draw a pixel at px-scrlx, py-scrly (where scrlx and
scrly are the coords you pass to MapDraw) it should be in the centre
of the block.<br><br>
<p><a href="#topod">(top of doc)</a> </p>

<hr>

<p><a name="isohlp"></a></p>
<h3>Isometric</h3>
<p>
The most common type of isometric map is the rotated/diamond type, but Mappy
produces a staggered row isometric map. If you really want to use a rotated/diamond
type you can change the playback libs to convert them on loading. Here's how they
compare:<br><br>
<img src="images/isodiag1.gif"><br><br>
To move one block in any direction use the following guide:<br><br>
<img src="images/isodiag2.gif"><br><br>
So, to get from x, y to the adjacent iso to the right and above, use a bit of code
like this (same as for the hex maps):<br><br>
<strong>
int a = 1-(y&amp;1);<br>
x = (x-a)+1;<br>
y = y-1;<br><br>
</strong>
To convert your block coords to pixel coords (same as for the hex maps), use:<br><br>
<strong>
px = x*mapblockgapx;<br>
py = (y/2)*mapblockgapy;<br>
if (!(y&amp;1)) {    //an even (not staggered) row<br>
// start of the map (0,0)  is offset by the stagger values<br>
	 px -= mapblockstaggerx;<br>
	 py -= mapblockstaggery;<br>
}<br>
px += mapblockwidth/2;    // centre of block<br>
py += mapblockheight/2;<br><br>
</strong>

So now if you draw a pixel at px-scrlx, py-scrly (where scrlx and
scrly are the coords you pass to MapDraw) it should be in the centre
of the block. If you are using a sprite array MapDrawRow is usually better.<br><br>
<h3>Moving anywhere on a staggered row isometric map</h3>
This is more complex to understand than a rotated map, but you can use a
function like this to make it
as easy (and pretty much the same) as using a rotated style map, just copy and paste
into your source:<br><br>
<strong>
void IsoMove (int ew, int ns, int * x, int * y)<br>
// ew = negative is west movement, positive is east<br>
// ns = negative is north movement, positive is south<br>
// x and y are coords to modify<br>
{<br>
int a = ew-ns;<br>
if (a&gt;0) a++;<br>
y[0] += ew+ns;<br>
x[0] += a/2;<br>
if (

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -