Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / TMX-Map-Loader - Load maps created with Tiled

Author
Message
Multicoder
AGK Developer
10
Years of Service
User Offline
Joined: 25th Oct 2014
Location: Germany
Posted: 13th Nov 2014 06:06 Edited at: 14th Nov 2014 12:24
Hi everyone,

I created a small loader for maps created with Tiled (http://www.mapeditor.org) usable if you navigate your level with SetViewOffset().

The requirements for the map-file for script to work are stated in the comments on top of the script.

Here is an example of loading a map-file called "map_2.tmx" and assigning the "collision" tiles to hitgroup 9991:


In case you don't want to download the file and instead want to copy & paste the contents:


If you find any errors or flaws feel free to tell me. I'll do my best do get rid of it

// EDIT: I forgot to mention that it doesn't work with only a set aspect ratio. You need to set a virtual resolution for this script to work.

Have fun

Yes, I am aware that I sound like a caveman to native english speakers

Attachments

Login to view attachments
MikeHart
AGK Bronze Backer
21
Years of Service
User Offline
Joined: 9th Jun 2003
Location:
Posted: 13th Nov 2014 17:43 Edited at: 13th Nov 2014 17:44
Awesome, was going to try that myself!
MikeHart
AGK Bronze Backer
21
Years of Service
User Offline
Joined: 9th Jun 2003
Location:
Posted: 13th Nov 2014 19:28
Ok, non of the Tiled90 sample maps work.
Multicoder
AGK Developer
10
Years of Service
User Offline
Joined: 25th Oct 2014
Location: Germany
Posted: 13th Nov 2014 19:37 Edited at: 13th Nov 2014 19:44
The examples don't meet the requirements because the tileset type is not "Collection of Images".
Here is a small sample map from me that meets the requirements (using this tileset: http://opengameart.org/content/rpg-pack-base-set)



// EDIT: This is how it looks like when loaded (without the character):


Yes, I am aware that I sound like a caveman to native english speakers
SoftMotion3D
AGK Developer
19
Years of Service
User Offline
Joined: 24th Aug 2005
Location: Calgary,Alberta
Posted: 13th Nov 2014 20:16 Edited at: 13th Nov 2014 20:20
why dont people just use tile studio....its the easiest way to load a 2d map into agk

sample code:


its really no code at all.
just dim your map size first and your good to go...

but i have never tried this tmx thing either so ? i dunno.
whats the benefits of using tmx vs tilestudio?

MikeHart
AGK Bronze Backer
21
Years of Service
User Offline
Joined: 9th Jun 2003
Location:
Posted: 13th Nov 2014 21:04
Quote: "whats the benefits of using tmx vs tilestudio?"


Tiled runs on OSX too. Has layers, you can define objects, etc etc.
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 13th Nov 2014 21:11
Kinda reinventing the wheel ain't ya?
Clonkex made a version originally based off my version. Just curious if you saw those posts or not.


"I like offending people, because I think people who get offended should be offended." - Linus Torvalds
Multicoder
AGK Developer
10
Years of Service
User Offline
Joined: 25th Oct 2014
Location: Germany
Posted: 13th Nov 2014 21:32 Edited at: 13th Nov 2014 21:37
Quote: "Kinda reinventing the wheel ain't ya?"

I... I... I... well... I think... I... I didn't use the forum search before I began to code
I didn't see these other versions, but well, it was good for learning some basic AGK-Stuff

Yes, I am aware that I sound like a caveman to native english speakers
MikeHart
AGK Bronze Backer
21
Years of Service
User Offline
Joined: 9th Jun 2003
Location:
Posted: 13th Nov 2014 21:42
Quote: "Kinda reinventing the wheel ain't ya?
Clonkex made a version originally based off my version. Just curious if you saw those posts or not."


Even if he saw them, I find it great that he shares his solution. There is no monopoly on code, or?
Daniel TGC
Retired Moderator
17
Years of Service
User Offline
Joined: 19th Feb 2007
Location: TGC
Posted: 14th Nov 2014 04:30
Hey I made a whole video on doing this, don't see my complaining about it there's many ways to approach this problem. It's great to have people sharing code!
Multicoder
AGK Developer
10
Years of Service
User Offline
Joined: 25th Oct 2014
Location: Germany
Posted: 14th Nov 2014 12:23
Thank you for your encouragement

I forgot to mention that it doesn't work with only a set aspect ratio. You need to set a virtual resolution for this script to work.

I'll update the main post as well.

Yes, I am aware that I sound like a caveman to native english speakers
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 14th Nov 2014 17:41
Oh nothing wrong with doing your own version, we've all made something that's already been done before I'm sure. Just thought I'd point out the other versions (and give myself a shameless self-promotion)


"I like offending people, because I think people who get offended should be offended." - Linus Torvalds
Impetus73
13
Years of Service
User Offline
Joined: 28th Aug 2011
Location: Volda, Norway
Posted: 15th Nov 2014 16:20
I once made the perfect "Hello World" program, but it seems like someone else also made it...

----------------
AGK programmer
Did Amiga / AMOS programming in the 90's.
SoftMotion3D
AGK Developer
19
Years of Service
User Offline
Joined: 24th Aug 2005
Location: Calgary,Alberta
Posted: 15th Nov 2014 21:36
hey... nothin wrong with reinventing the wheel. I think ive made several music apps by now and am thinking of doing another

george++
AGK Tool Maker
17
Years of Service
User Offline
Joined: 13th May 2007
Location: Thessaloniki, Hellas
Posted: 15th Nov 2014 22:11
Everyone can have different aspect of view.
Personally I like text files, so I've made a parser for TMX files
Here is for anyone who might be intersted:
http://forum.thegamecreators.com/?m=forum_view&t=209885&b=41
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 16th Nov 2014 04:14
For optimal loading times, converting TMX into a binary format to fit your needs would be best I think.


"I like offending people, because I think people who get offended should be offended." - Linus Torvalds
Duffer
21
Years of Service
User Offline
Joined: 9th Feb 2003
Location: chair
Posted: 29th Dec 2014 20:40
@ Multicoder,

This is great. Will it support orthographic (isometric) tmx tiles?

a long time dabbler with DBC and DBPro with no actual talent but lots of enthusiasm...
3d point in space
15
Years of Service
User Offline
Joined: 30th Jun 2009
Location: Idaho
Posted: 29th Dec 2014 22:53 Edited at: 30th Dec 2014 00:28
hay I just wondering you use csv export but I don't see the export in the newer versions of tiled.
I have an older version that works fine, but if I go to preferences in 10.2 it does not have the drop down menu for csv does anyone know what I am doing wrong with the new version of tiled. I guess if no one knows I keep using version 8.1. Yea I made a tmx file loader in 2011 I think I will share the post. I had to redo a lot of graphics for my rpg. I am doing the houses as separate files instead of making the hole city. The reason why I had to redo my graphics is because I cant use rpg game maker graphics in my app.

Developer of Space Chips, pianobasic, zipzapzoom, and vet pinball apps. Developed the tiled map engine seen on the showcase. Veteran for the military.

Attachments

Login to view attachments

Login to post a reply

Server time is: 2024-11-25 15:00:48
Your offset time is: 2024-11-25 15:00:48