2d map for an rpg
#2 Members - Reputation: 102
Posted 08 January 2012 - 06:33 PM
0 1 2 5 0 1
2 3 4 1 0 2
1 0 3 4 1 0
1 2 5 3 0 1
Where each of the numbers is the id of a type of square. So '0' might be dirt, '2' might be rock, etc. The file could look like a grid so that you can easily look at it and see what everything represents.
You can also use a tool such as Mappy: http://tilemap.co.uk/mappy.php
Or just make your own tile editor.
You just need a file that has a list of all the tiles in your world, and probably some info such as width and height of the world in tiles. Then your program can just open up the file, read the info it needs (width and height), then read in the tiles one-by-one. You can organize the tiles in an array.
#3 Crossbones+ - Reputation: 3420
Posted 08 January 2012 - 07:00 PM
Beginner in Game Development? Read here.
Super Mario Bros clone tutorial written in XNA 4.0 [MonoGame, ANX, and MonoXNA] by Scott Haley
If you have found any of the posts helpful, please show your appreciation by clicking the up arrow on those posts ![]()
#4 Members - Reputation: 293
Posted 08 January 2012 - 07:10 PM
Thanks
#5 Crossbones+ - Reputation: 3420
Posted 08 January 2012 - 07:40 PM
Beginner in Game Development? Read here.
Super Mario Bros clone tutorial written in XNA 4.0 [MonoGame, ANX, and MonoXNA] by Scott Haley
If you have found any of the posts helpful, please show your appreciation by clicking the up arrow on those posts ![]()
#7 Crossbones+ - Reputation: 3420
Posted 08 January 2012 - 08:14 PM
- After that get a static background on the screen and have the character/object move around in it.
- Add another character (NPC) that randomly moves around the screen.
- Get your character/object to shoot a projectile in the direction you are facing.
Beginner in Game Development? Read here.
Super Mario Bros clone tutorial written in XNA 4.0 [MonoGame, ANX, and MonoXNA] by Scott Haley
If you have found any of the posts helpful, please show your appreciation by clicking the up arrow on those posts ![]()
#10 Crossbones+ - Reputation: 3420
Posted 08 January 2012 - 11:33 PM
- Have a file that has 20 letters across and 20 down. In all the grid should have 400 letters all together.
- Load that file, read the file one letter at a time and display each letter.
- Now associate a grass graphic with the letter g, rock graphic with the letter r, bush graphic with the letter b.
- Now create another 20 x 20 file filled with all r, g, and b's.
- Having the association of letter to graphic and reading that file should create a 20 x 20 map of rocks, grass, and bushes.
- You may or may not want to use a 2-dimensional array for this, depending on your approach.
Again, feel free to post code when you're done. But there people far more knowledgeable and experience than me that can help you with your approach, architecture, and code.
Note: see you tomorrow.
Beginner in Game Development? Read here.
Super Mario Bros clone tutorial written in XNA 4.0 [MonoGame, ANX, and MonoXNA] by Scott Haley
If you have found any of the posts helpful, please show your appreciation by clicking the up arrow on those posts ![]()
#11 Members - Reputation: 1614
Posted 09 January 2012 - 12:35 PM
What you want is your world laid out in a map-tile editor, and you can actually see what it's going to look like on screen.
So, check out Mappy, or Tiled (google them), and port the output into your game, or you're going to write your own map.
FWIW, I'd suggest using Mappy or Tiled, but creating your own can have benefits as well. If you create your own, be sure most of the functionality will be re-used in your game.
---(Old Blog, still has good info): 2dGameMaking
-----
"No one ever posts on that message board; it's too crowded." - Yoga Berra (sorta)
#12 Crossbones+ - Reputation: 3420
Posted 09 January 2012 - 12:38 PM
Beginner in Game Development? Read here.
Super Mario Bros clone tutorial written in XNA 4.0 [MonoGame, ANX, and MonoXNA] by Scott Haley
If you have found any of the posts helpful, please show your appreciation by clicking the up arrow on those posts ![]()
#13 Members - Reputation: 205
Posted 09 January 2012 - 12:58 PM
These TileObjects can store the type of image being displayed (background and possible images on top like trees or 3d effects), the type of tile (passable or not), possibly the movements costs and a pointer to the object currently on it (a nullptr in case the tile is not occupied). Although I have to admit not having any experience in these kind of games, so I'm not sure about the performance using a system like this. This way you won't have to use collision detection, you can just use if(RelativeTile(1,0)->IsPassible() && RelativeTile(1,0)->Occupier() == nullptr) {moveRight()}
You do have to write your own map editor in that case.
#14 Members - Reputation: 1426
Posted 09 January 2012 - 01:36 PM
#15 Crossbones+ - Reputation: 3420
Posted 09 January 2012 - 01:48 PM
Beginner in Game Development? Read here.
Super Mario Bros clone tutorial written in XNA 4.0 [MonoGame, ANX, and MonoXNA] by Scott Haley
If you have found any of the posts helpful, please show your appreciation by clicking the up arrow on those posts ![]()
#16 Members - Reputation: 293
Posted 09 January 2012 - 09:33 PM
Have a file that has 20 letters across and 20 down. In all the grid should have 400 letters all together.
- Load that file, read the file one letter at a time and display each letter.
- Now associate a grass graphic with the letter g, rock graphic with the letter r, bush graphic with the letter b.
- Now create another 20 x 20 file filled with all r, g, and b's.
- Having the association of letter to graphic and reading that file should create a 20 x 20 map of rocks, grass, and bushes.
- You may or may not want to use a 2-dimensional array for this, depending on your approach.
I'm kinda lost on how to do that.
So, create a text file with 400 characters, load it, read it. That's about as far as I got.
#17 Crossbones+ - Reputation: 3420
Posted 09 January 2012 - 10:49 PM
Beginner in Game Development? Read here.
Super Mario Bros clone tutorial written in XNA 4.0 [MonoGame, ANX, and MonoXNA] by Scott Haley
If you have found any of the posts helpful, please show your appreciation by clicking the up arrow on those posts ![]()
#19 Crossbones+ - Reputation: 3420
Posted 09 January 2012 - 10:54 PM
Beginner in Game Development? Read here.
Super Mario Bros clone tutorial written in XNA 4.0 [MonoGame, ANX, and MonoXNA] by Scott Haley
If you have found any of the posts helpful, please show your appreciation by clicking the up arrow on those posts ![]()






