School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become an Expert!

Join 308,429 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 3,266 people online right now. Registration is fast and FREE... Join Now!




adding a map to your game

 

adding a map to your game

sly

13 Aug, 2009 - 05:04 PM
Post #1

D.I.C Head
**

Joined: 5 Dec, 2008
Posts: 98

Hi, I am trying to make an rpg game in java and basically only have a moving sprite right now. Now I want to add a map to the game, so I downloaded Tiled a program that lets you make maps. I do not know what to do next, what do I save the map under? How do I implement the map into my game?

Please help me... Thanks!

User is offlineProfile CardPM
+Quote Post

 
Reply to this topicStart new topic
Replies(1 - 5)

SixOfEleven

RE: Adding A Map To Your Game

13 Aug, 2009 - 05:21 PM
Post #2

lives.ToCode();
Group Icon

Joined: 18 Oct, 2008
Posts: 3,096



Thanked: 175 times
Dream Kudos: 825
Expert In: C, C#, XNA, Game Programming, Programming Concepts

My Contributions
There are a variety of ways to save a tile map. Usually the best way is in an 2D array of integers where the integer would be the index of the tile in the tile set. (If you are using a tile set. If you are using just individual tiles it would be the index of the tile in an array of images.) You could also use a custom format like CSV file and parse the file to find out what tile to draw and where to draw it. The 2D array wouldn't take into account layered tile maps. If you wanted a layered tile map you would have an array of 2D arrays, one for each layer in the map. With out knowing the specific options for the program you are using it is a little hard to know what option would be best for you.
User is offlineProfile CardPM
+Quote Post

sly

RE: Adding A Map To Your Game

13 Aug, 2009 - 05:31 PM
Post #3

D.I.C Head
**

Joined: 5 Dec, 2008
Posts: 98

I made layers in my map and would like all of them to show, I am still confused on how to import the map into the game and make it work... Would it help you out if i showed you my code?
User is offlineProfile CardPM
+Quote Post

SixOfEleven

RE: Adding A Map To Your Game

13 Aug, 2009 - 05:48 PM
Post #4

lives.ToCode();
Group Icon

Joined: 18 Oct, 2008
Posts: 3,096



Thanked: 175 times
Dream Kudos: 825
Expert In: C, C#, XNA, Game Programming, Programming Concepts

My Contributions
A link to the program you used would be helpful, so I can see what options are available for saving the maps. Knowing how the maps are saved will help give you an answer on how to read in and draw the maps. smile.gif
User is offlineProfile CardPM
+Quote Post

sly

RE: Adding A Map To Your Game

13 Aug, 2009 - 06:52 PM
Post #5

D.I.C Head
**

Joined: 5 Dec, 2008
Posts: 98

http://mapeditor.org/
User is offlineProfile CardPM
+Quote Post

stayscrisp

RE: Adding A Map To Your Game

14 Aug, 2009 - 01:45 AM
Post #6

Mouth->Insert(Foot);
Group Icon

Joined: 14 Feb, 2008
Posts: 1,410



Thanked: 55 times
Dream Kudos: 300
My Contributions
Hi

Tiled is a map editor so it will only edit your maps, you can use the plugins to load up your existing maps but you will still have to write something to use them within your code.

Someone has written a library to load Tiled maps here, I think it is in Java, it also has a good description of the various classes within the library so that maybe one day you could write your own smile.gif

Good Luck icon_up.gif
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 11/24/09 01:53PM

Live Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month