I have written 2 nice classes for this. One which will read external maps (thanks to jgo for this one though!), and one who will create an image from a 2d array. For different levels i do the following:Create 3 different external map objects for 3 levels. Have 1 background image. Now as soon as the game starts, youll give your background image the value of an external 2d array, this array is external mab object level 1. As soon as you finish a level, you go give it the value of the second external 2d value. Etc etc etc.Ill upload it once im on uni today, i think it suits all your needs!

I am going to make a 2D top down view (Like Link to the Past) with 16x16 tiles that I created. How can I display this and how can I have multiple areas i.e. a room?Thanks,Jhost

Java2D works fine for a map that small, and probably for anything larger too (depending on the tile size though). There are however some things that are potentially VERY expensive with Java2D. For example, scaling, rotating and transparency are very slow and should be avoided. If you will not be using those then you'll have no problem with just Java2D.

Like elamre said, it might be easier to store the map in an external map file and then make a simple parser to interpret the file, if only for readability's sake. Initializing a 2D array with all the tiles could get pretty messy once you have a large map.

Ok so now we have a class which will take the map location as input, and returns the 2d array as output. Note this is NOT necessary, but it makes everything a lot easier to manage, reuse and saves up precious source code space.

Where 1 are the walls, 2 is a table for example. Now you have the array, whats next?You want to draw everything on the screen. For this im not quite sure what you exactly need at this point. A class which loads the images of a tilesheet? ill just give you a simplefied version of my code:

Thanks a bunch man, I loved the explaining it helps rather than just giving out code! Just one more question, what do you mean by draw it? I'm sorry but I'm a bit of a noob in Java Game Development. There's a medal for you . I was wondering if you would add me in skype? PM me for it and thanks again.

Thanks a bunch man, I loved the explaining it helps rather than just giving out code! Just one more question, what do you mean by draw it? I'm sorry but I'm a bit of a noob in Java Game Development. If I could give you rep I would . I was wondering if you would add me in skype? PM me for it and thanks again.

Just out of question, as I have found a rather interesting MapEditor ( http://sites.google.com/site/juddman/ )that saves as text files, would this be useful and could I use the code to convert this to a 2D array?

No problems at all, i find that doing both is the most effective. Sometimes people just give explanation, without a sample code. This is really frustrating if you are still not able to finish it. And only code doesnt help anybody either.Im glad that i finally could help somebody, instead of just asking help on the forums and profit from it (which really isnt my intention btw).Sure pm is on its way. It only seems that our timezones are totally different (as in, your day starts when im asleep, and when im posting you seem to be asleep :p ).

And yes you could basicly use everything. Youll just have to find an algorithm to convert the array to the map.You could also use Tiled, with some modifications to the array to image code. The Text to 2dArray should suit for almost everything, and shouldnt require a lot of changes for use with other programs like the one you listed. Btw did you succeed in drawing it? otherwise check these small tutorials out:http://zetcode.com/tutorials/javagamestutorial/I loved those, and that is what i started with.

Also uprightPath, why are they using a singleton? isnt it just much easier to make a static class with static variable? does the same thing, but then easier (and better, according to our java teacher at uni)

I added you on skype. Maybe we could work together on a game. I really think you would be good at making videos on making a java 2d game like the one I have described here from scratch. I know I would watch them!

java-gaming.org is not responsible for the content posted by its members, including references to external websites,
and other references that may or may not have a relation with our primarily
gaming and game production oriented community.
inquiries and complaints can be sent via email to the info‑account of the
company managing the website of java‑gaming.org