GLBasic forum

Codesnippets => Code Snippets => Topic started by: Moru on 2008-Feb-27

Title: Tilemaps: Mappy loader for FMP format v1.0
Post by: Moru on 2008-Feb-27
Another version for the FMP loader. It only supports version 1.0 of the format so make sure you set that in the editor!
Now scrolling is working as expected. You can turn on or off wrap North/South, East/West. No collision yet because I'm still working on getting the sprite.y sorting to work well.

http://gamecorner.110mb.com (http://gamecorner.110mb.com) - click the code tab
Updated 2008-08-17

Screen updates with animated tiles at around 20 fps on a GP2X with eight layers of tiles. (If you ever would like that many layers)

Each tile will have four flags for collision so you can make tiles that block passage in 1, 2 or three directions (or all four for that matter) Makes for nice placements of chairs or fences that don't have to waste a whole tile for blocking.
Title: Mappy loader for FMP format v1.0
Post by: D2O on 2008-Feb-28
Nice :)
Title: Mappy loader for FMP format v1.0
Post by: Kitty Hello on 2008-Feb-28
Aces! That was one we were really missing!
Title: Re: Tilemaps: Mappy loader for FMP format v1.0
Post by: Moru on 2008-Aug-18
Finaly a new version up with actual working scrolling and sprite y sorting :-)
Title: Re: Tilemaps: Mappy loader for FMP format v1.0
Post by: onugl on 2008-Aug-18
Quote from: Moru on 2008-Aug-18
Finaly a new version up with actual working scrolling and sprite y sorting :-)
=D Nice! I will use it for my future projects!
Title: Re: Tilemaps: Mappy loader for FMP format v1.0
Post by: equinox on 2008-Sep-18
You can explain me,please, how to use and to compile the files that I find in the file zip? 

Tnk1000.
Title: Re: Tilemaps: Mappy loader for FMP format v1.0
Post by: Moru on 2008-Sep-18
You start off by putting all the files into their own map in your code-library. Start the "Mappy Loader.gbap" file and look in the example.gbas to see how the map is loaded. There should be comments explaining each stage.

Let me know if there is something specific you want explained!
Title: Re: Tilemaps: Mappy loader for FMP format v1.0
Post by: Moru on 2009-Jan-12
Ok, finaly made it to find some time for the collision code. It's mostly working, only problem is if you set a block that has the override collision-flag on any layer, that will get you stuck on that block. The collision is usable without this function, it's just for making the mapping easier without having to create lots of extra tiles for bridges over rivers and similar things. If you test the example you will get stuck on the bridge, the left landing-stages in the lake and the cave opening.

The special part of the collision in Mappy is that you can set edges as collision instead of the whole block. For example you can make a block that blocks you from going left and right but you can go up and down. this makes it easy to put up fences that only takes the edge of each block. If you test the example, the brown area to the left and right is supposed to be a fence, you can walk around inside them and outside without there being a big block that prevents you from going close to the fence from one side.

You get to the collision flags if you double-click the block and set the flags that are in a small square. Meaning as follows:




X UpX Right
X DownX Left

To get one block to take preference over all other blocks on the same place in all layers you set the flag 3 on that block. This is not totaly working yet as explained above but that is the plan for the future.

If you want the correct names on the flags you can insert this line into the MAPWIN.INI file in Mappys install map:
Code (glbasic) Select
blockdialoguelabels=User data:;U1;U2;U3;U4;U5;U6;U7;up;ri;dn;le;bg transp;flag 1;flag 2;flag 3;

As usual, download the code with examples on my homepage:
http://gamecorner.110mb.com (http://gamecorner.110mb.com)