Be a Supporter!

platformer tile map

  • 373 Views
  • 4 Replies
New Topic Respond to this Topic
Robokilldesign231
Robokilldesign231
  • Member since: Sep. 7, 2009
  • Offline.
Forum Stats
Member
Level 07
Blank Slate
platformer tile map Jan. 25th, 2013 @ 07:45 PM Reply

Hello everyone
First of all I want you to Know I'm italian so, please forgive my english,...
now..I've got a problem, I am approaching to flash games developement and I already have an idea on how hard it can be..I was trying to make a platform game,nothing special just to get used with flash cs6 and i'm creating my own 8-bit sprites with illustrator...what is driving me crazy are maps...I don't know if there are some tile map creators online or somthing like that, but please if you have any suggestion on how to create game levels(maps) or if you can tell me if there are any "easy to use" programs, I would really appreciate...you know it's always been a dream for me to create games since I can really say I grew up with them :D Grazie mille!!

Spysociety
Spysociety
  • Member since: Dec. 30, 2009
  • Offline.
Forum Stats
Member
Level 21
Blank Slate
Response to platformer tile map Jan. 25th, 2013 @ 08:55 PM Reply

You don't need a tile editor to create a tile-based game. If you want a 2D tile-based environment you need to know about multidimensional arrays, loops and nested loops at least.

First to "draw" your map you need to create an array containing multiple numers which mean some type of tile, for example, 0 is green tile, 1 is yellow tile.

var map:Array = [[0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0],
                                               [0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0],
                                               [0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0],
                                               [0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0]];
egg82
egg82
  • Member since: Jun. 24, 2006
  • Offline.
Forum Stats
Member
Level 05
Game Developer
Response to platformer tile map Jan. 25th, 2013 @ 09:38 PM Reply

At 1/25/13 08:55 PM, Spysociety wrote: var map:Array = [[0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0],
[0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0]];

the multidimensional array is good, but it can be reduced to a single-dimensional vector, increasing the lookup speed by quite a bit.

private function coordsToArray(x:uint, y:uint):uint {
	return _map[(y * _mapWidth) + x];
}

private function arrayToCoords(position:uint):Point {
	return new Point(Math.floor(position / _mapWidth), position % _mapWidth);
}

Programming stuffs (tutorials and extras)
PM me (instead of MintPaw) if you're confuzzled.
thank Skaren for the sig :P

BBS Signature
egg82
egg82
  • Member since: Jun. 24, 2006
  • Offline.
Forum Stats
Member
Level 05
Game Developer
Response to platformer tile map Jan. 25th, 2013 @ 09:39 PM Reply

At 1/25/13 09:38 PM, egg82 wrote: private function arrayToCoords(position:uint):Point {
return new Point(Math.floor(position / _mapWidth), position % _mapWidth);
}
private function arrayToCoords(position:uint):Point {
	return new Point(position % _mapWidth, Math.floor(position / _mapWidth));
}

Point works in x, y - not y, x. Herp.


Programming stuffs (tutorials and extras)
PM me (instead of MintPaw) if you're confuzzled.
thank Skaren for the sig :P

BBS Signature
Robokilldesign231
Robokilldesign231
  • Member since: Sep. 7, 2009
  • Offline.
Forum Stats
Member
Level 07
Blank Slate
Response to platformer tile map Jan. 28th, 2013 @ 11:51 AM Reply

thanks a lot this should help! I guess I have to study more AS language...I used to create ground in illustrator and then put code on it...