Java-Gaming.org Hi !
Featured games (81)
games approved by the League of Dukes
Games in Showcase (513)
Games in Android Showcase (119)
games submitted by our members
Games in WIP (576)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  How To Make A Tile Map?  (Read 567 times)
0 Members and 1 Guest are viewing this topic.
Offline PeterNicholson
« Posted 2012-08-27 15:04:34 »

Hello!
Could anybody help me out here? I am making a tile-based game, but I don`t know how to get around to making the map Huh I have tried making It like this:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
148  
149  
150  
151  
152  
153  
154  
// grass border
       
        //left side
        grass(0, 0);
        grass(0, 50);
        grass(0, 100);
        grass(0, 150);
        grass(0, 200);
        grass(0, 250);
        grass(0, 300);
        grass(0, 350);
        grass(0, 400);
        grass(0, 450);
        grass(0, 500);
        grass(0, 550);
       
        //top
        grass(50, 550);
        grass(100, 550);
        grass(150, 550);
        grass(200, 550);
        grass(250, 550);
        grass(300, 550);
        grass(350, 550);
        grass(400, 550);
        grass(450, 550);
        grass(500, 550);
        grass(550, 550);
       
        //rigth side
        grass(550, 0);
        grass(550, 50);
        grass(550, 100);
        grass(550, 150);
        grass(550, 200);
        grass(550, 250);
        grass(550, 300);
        grass(550, 350);
        grass(550, 400);
        grass(550, 450);
        grass(550, 500);
       
        //bottom
        grass(0, 0);
        grass(50, 0);
        grass(100, 0);
        grass(150, 0);
        grass(200, 0);
        grass(250, 0);
        grass(300, 0);
        grass(350, 0);
        grass(400, 0);
        grass(450, 0);
        grass(500, 0);
       
        //stone market
       
        //left side
        stone(50, 50);
        stone(50, 100);
        stone(50, 150);
        stone(50, 200);
        stone(50, 250);
        stone(50, 300);
        stone(50, 350);
        stone(50, 400);
        stone(50, 450);
        stone(50, 500);
       
        //top
        stone(50, 500);
        stone(100, 500);
        stone(150, 500);
        stone(200, 500);
        stone(250, 500);
        stone(300, 500);
        stone(350, 500);
        stone(400, 500);
        stone(450, 500);
        stone(500, 500);
       
        //rigth side
        stone(500, 50);
        stone(500, 100);
        stone(500, 150);
        stone(500, 200);
        stone(500, 250);
        stone(500, 300);
        stone(500, 350);
        stone(500, 400);
        stone(500, 450);
        stone(500, 500);
       
        //bottom
        stone(100, 50);
        stone(150, 50);
        stone(200, 50);
        stone(250, 50);
        stone(300, 50);
        stone(350, 50);
        stone(400, 50);
        stone(450, 50);
        stone(500, 50);
       
        //inside
       
        //left side
        stone(100, 100);
        stone(100, 150);
        stone(100, 200);
        stone(100, 250);
        stone(100, 300);
        stone(100, 350);
        stone(100, 400);
        stone(100, 450);
       
        //top
        stone(150, 450);
        stone(200, 450);
        stone(250, 450);
        stone(300, 450);
        stone(350, 450);
        stone(400, 450);
        stone(450, 450);
       
        //right side
        stone(450, 400);
        stone(450, 350);
        stone(450, 300);
        stone(450, 250);
        stone(450, 200);
        stone(450, 150);
        stone(450, 100);
       
        //bottom
        stone(400, 100);
        stone(350, 100);
        stone(300, 100);
        stone(250, 100);
        stone(200, 100);
        stone(150, 100);
        stone(100, 100);
       
        //inside2
       
        //row1
        stone(200, 400);
        stone(250, 400);
        stone(300, 400);
        stone(350, 400);
        stone(400, 400);
       
        //row2
        stone(200, 300);

... but it took me such a long time, that I got discuradged! Please, could anybody help me? I am looking for a program, in wich you can make the  map, and then export it to the PNG format. Please Help  Shocked

Subscribe to me on YouTube: http://youtube.com/javaprogrammerguy
Offline sproingie

JGO Kernel


Medals: 202



« Reply #1 - Posted 2012-08-27 15:25:34 »

Store the map in a int[][] and assign each tile an int.  Loop through the indexes of the array, multiply them by their tile size, and you have your coordinates.  I saw you in another thread saying you preferred your above approach, but now I think you're finding out why we use data structures after all.

Also, you really don't want to be putting each tile type in its own texture.  Check out SpriteSheet in slick2d or TextureRegion in libgdx.
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Longarmx (45 views)
2014-10-17 03:59:02

Norakomi (36 views)
2014-10-16 15:22:06

Norakomi (27 views)
2014-10-16 15:20:20

lcass (31 views)
2014-10-15 16:18:58

TehJavaDev (61 views)
2014-10-14 00:39:48

TehJavaDev (61 views)
2014-10-14 00:35:47

TehJavaDev (51 views)
2014-10-14 00:32:37

BurntPizza (69 views)
2014-10-11 23:24:42

BurntPizza (39 views)
2014-10-11 23:10:45

BurntPizza (81 views)
2014-10-11 22:30:10
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
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
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!