GameGum Forum

Discuss with the other members of GameGum.

Tile map engine(Made by MrcredsAlex)

User

Message

MrcredsAlex Avatar

MrcredsAlex

Posts: 7
GumPoints: 554

Hey this is the tile map engine I made. (originally posted here)





New version 2: Like maxY, maxTile lets you change the max tile number. Also fixed bug that started from 3 instead of maxY in reading the X varialbe
New version: Instead of need to type for example 0033(or 0033500 including X axis at the end which can be up to unlimited, that’s why there isn’t an maxX variable) as Y, now you can type instead 033(or 033500 including X axis at the end which can be up to unlimited, that’s why there isn’t an maxX variable) as Y with the maxY variable.
That means you can have less or more than 3 digits, not forever 3.
This is an tile map engine made by me I’m using to make Super Tile Ixtipi.
Here’s the code:


buildMap = function (map:Array, maxY:Number, maxTile:Number) {
var i:Number = 0;
while (i tileHandle = attachMovie("tile"+map[i].slice(0, maxTile), "tile"+i, getNextHighestDepth());
tileHandle.
y = map[i].slice(maxTile, maxY);
tileHandle.x = map[i].slice(maxY, map[i].length);
i++;
}
};


You can make a map doing this:

var map:Array;

For example, we can put:

var map1:Array = ["031", "091150"];

This will create tile 0 on the Y axis 31 and on undefined X axis, and it will create too tile 0 on the X axis 50 and on the Y axis 911
The tile number must have 1 digit(up to 9)(or on the new version 2 up to anything you want) The Y axis must have 3 digits(up to 999)(or on the new version up to anything you want) The X axis can have unlimited digits(Up to infinity)
To create the tiles:
Make a movie clip and make it’s linkage name tile
number. For example, tile0.
An example of everything:

Stage.showMenu = false;
stop();
buildMap = function (map:Array, maxY:Number, maxTile:Number) {
var i:Number = 0;
while (i tileHandle = attachMovie("tile
"+map[i].slice(0, maxTile), "tile"+i, getNextHighestDepth());
tileHandle.y = map[i].slice(maxTile, maxY);
tileHandle.
x = map[i].slice(maxY, map[i].length);
i++;
}
};
var map1:Array = ["031", "091150"];
buildMap(map1,3,1);



Happy tile map creating!

  • Jun 11, 2007
Skuld Avatar

Skuld

Posts: 851
GumPoints: 5,402

X-| I think proph3t needs to work on making a code tag for posts.

  • Jul 7, 2007
curlyfries Avatar

curlyfries

Posts: 771
GumPoints: 2,143

It must have taken you sooo long to do that.....and people dont even understand it

  • Jul 7, 2007
NArc0t1c Avatar

NArc0t1c

Posts: 10
GumPoints: 212

Could be usefull at times..

  • Aug 13, 2007
tank2tank Avatar

tank2tank

Posts: 132
GumPoints: 1,121

My brain just melted. I hate code.

  • Aug 14, 2007
proph3t Avatar

proph3t

Posts: 234
GumPoints: 1,845

Hmm somehow missed this thread, will have to work on the code tags.

  • Aug 14, 2007
Skuld Avatar

Skuld

Posts: 851
GumPoints: 5,402

Looks like they are working. =)

  • Aug 19, 2007
proph3t Avatar

proph3t

Posts: 234
GumPoints: 1,845

Yea we put some time into that :)

  • Aug 19, 2007
Skuld Avatar

Skuld

Posts: 851
GumPoints: 5,402

Can you add what the code tag is to the little box at the bottom that shows the other codes?

  • Aug 20, 2007

Add Reply

Link:[Title](http://example.com/) Image:![Name](http://example.com/image.jpg) Italic:*text* Bold:**text**