How to add a map in dart?

347 views
Skip to first unread message

Harry

unread,
Apr 15, 2013, 9:56:45 AM4/15/13
to mi...@dartlang.org
I'm gonna add a game's map in dart,
I use this map design by tile map.
how can i add in dart and display on html ??

Harry

unread,
Apr 15, 2013, 10:02:22 AM4/15/13
to mi...@dartlang.org
Or is there any way to create game's map in dart?

Mike Watson

unread,
Apr 15, 2013, 11:09:43 AM4/15/13
to mi...@dartlang.org
The canvas examples here should help get you started : https://github.com/threeDart/three.dart

Harry

unread,
Apr 15, 2013, 12:32:00 PM4/15/13
to mi...@dartlang.org
thank you !
but I want 2D map examples 
because I make 12*12 static map!
I don't know how to add in dart...

Kevin Moore

unread,
Apr 15, 2013, 12:38:27 PM4/15/13
to General Dart Discussion
Do you mean a 2D array?


...if that's what you need.


--
Consider asking HOWTO questions at Stack Overflow: http://stackoverflow.com/tags/dart
 
 

Harry

unread,
Apr 15, 2013, 1:10:31 PM4/15/13
to mi...@dartlang.org
Thank you!
But not this...
I make a map like this:

<?xml version="1.0" encoding="UTF-8"?>

<map version="1.0" orientation="orthogonal" width="12" height="12" tilewidth="32" tileheight="32">

 <tileset firstgid="1" name="while" tilewidth="32" tileheight="32">

  <image source="010327_01.jpg" width="599" height="600"/>

 </tileset>

 <tileset firstgid="325" name="black" tilewidth="32" tileheight="32">

  <image source="pics_600031_1278309279.gif" width="1920" height="1080"/>

 </tileset>

 <tileset firstgid="2305" name="010327_01" tilewidth="32" tileheight="32" spacing="32" margin="32">

  <image source="010327_01.jpg" width="599" height="600"/>

 </tileset>

 <layer name="background" width="12" height="12">

  <data encoding="csv">

39,38,326,38,38,326,326,38,38,38,326,2316,

326,38,38,38,38,38,38,326,326,38,38,38,

326,38,326,38,326,38,326,38,38,326,326,326,

38,326,326,326,326,326,38,326,38,38,326,326,

38,326,326,326,505,326,326,326,38,326,38,326,

38,38,38,326,505,505,505,326,326,326,326,38,

38,38,326,326,505,38,38,38,326,326,326,38,

38,38,326,326,326,38,38,505,38,38,38,38,

38,326,326,38,326,505,38,505,38,38,38,505,

38,326,326,326,38,326,505,505,505,38,38,505,

38,38,38,38,326,326,505,38,505,38,505,38,

38,38,38,326,38,38,505,38,505,38,38,38

</data>

 </layer>

</map>


and I don't know how to add in dart....

Allan MacDonald

unread,
Apr 15, 2013, 1:32:10 PM4/15/13
to General Dart Discussion
AreaElement and MapElement are implemented in Dart for accomplishing this.


Allan


--

Allan MacDonald

unread,
Apr 15, 2013, 2:09:07 PM4/15/13
to mi...@dartlang.org
After looking closer at what you are asking, I am thinking you need a port (of openlayers) from javascript to Dart or use js-interop with something like http://openlayers.org/.

I am not aware of any existing Dart projects that do this, but there may be.

Allan

Fernando Daniel Tiberti

unread,
Apr 16, 2013, 1:15:00 PM4/16/13
to mi...@dartlang.org
Actually, what Harry has here is a .tmx map, which is a tile map generated by the Tiled Map Editor

I think no one built a tmx parser yet. You could use JS interop to use this one: tmx-loader.js
Or maybe implement a loader using the asset_pack library. Or you could try porting a tmx loader, or building one from scratch, I don't think it would be that hard.

Maybe take a look at darty-grits , which is a port of the JS game "Grits" used in this tutorial, which I think makes use of a TMX map.
Reply all
Reply to author
Forward
0 new messages