Example of scrolling tile map (using Tile Studio)

BlitzMax Forums/BlitzMax Tutorials/Example of scrolling tile map (using Tile Studio)

Wiering(Posted 2006) [#1]
The following example shows a very easy way to set up scrolling layers using Tile Studio ( http://tilestudio.sourceforge.net/ ).

http://tilestudio.sourceforge.net/tilemap.zip

Note: you can't compile Demo.bmx right away, first you need to load Demo.tsp into Tile Studio and press F10 (generate code), that will generate the missing .bmx and .png files.

This module supports transparent layers, animated tiles, overlapping tiles (set the overlap value in Tile Studio) and handles scaling. All maps and tiles are included into the executable.

If you make your own maps in Tile Studio, be sure to set BMXPNG.tsd as your exporter. To create animated tiles, see the Tutorial at http://tilestudio.sourceforge.net/tutor.html (Animation).


Pit-le-rouge(Posted 2006) [#2]
Hi Mike.

I see two problems in your example:
1) Fundamental.
BMax is a cross-platform language.
And your TileStudio is windows only......
So, on my Mac, I can't do nothing with your appli....

2) Detail.
A lack of comments in your demo.

Cheers


deps(Posted 2006) [#3]
I'm a mac user too. :/

But it looks really nice! :)


Wiering(Posted 2006) [#4]
Thanks for your comments. Unfortunately, I didn't have BlitzMax when I started to write Tile Studio. It was made in Dephi. Maybe some day, FPC + Lazarus will be able to compile it... BTW I've heard of Linux users who use Tile Studio through Wine, is there no Windows emulator for the MAC?

Anyway, I just updated tilemap.zip to also include the generated files, so you can at least compile the demo.

As far as comments, I thought it would be clear what the remaining code does. It just makes the maps move at a constant speed and bounce at the edges.


bradford6(Posted 2006) [#5]
Thanks for this Mike.

could you knock up an example with collisions?


jankoM(Posted 2006) [#6]
Very nice. Thanks Mike... now I just need to learn how to do pixelart :) .

Collisions should not be a problem I think... just some math and checking values at that arrays.


Wiering(Posted 2006) [#7]
It shouldn't be too hard to implement collision detection, here is how you can get the bound map value of the tile at (X, Y):

 Method ReadBoundMap: Int (X: Int, Y: Int)
   Local bnds: Int = 0
   Local flags: Int = 0  ' Not used here
   If FindPositionInMap (X, Y, flags) Then
     bnds = MapData[Y][X]
   End If
   Return bnds
 End Method

The bound map value is a 16 bit value. The higher 8 bits contain a value 0-$FF that you can add to each tile in the map in Tile Studio (use it for whatever you like) and the lower 8 bits contain the collision bounds (described all the way at the bottom of http://tilestudio.sourceforge.net/tutor.html ).


Ricardo_C(Posted 2006) [#8]
TileStudio does indeed run quite nicely through Wine, so this code is a God-send for Linux-heads too :) Thanks, Mike!


RetroRusty(Posted 2007) [#9]
Has anyone actually written a small platform game using Tile Studio and BlitzMax with full collision, other than just the rolling demo we have here?

Thanks