tle based engine help
Can someone help me? Im having trouble with making a tile based engine. How do you make a map from a .txt file and how do you tell if a tile is walkable or not?
There are absolutely LOADS of tutorials on this out there on the net (and here on gamedev), but you want actual help, so here goes.
The easiest way of doing this is to have a simple text file like this:
10, 10, 02, 10, 10
10, 02, 02, 02, 10
10, 02, 02, 02, 10
10, 02, 02, 02, 10
10, 10, 10, 10, 10
You also have a map like this:
int Map[5][5]
You then just read the values into the map array one at a time.
As for the second question, the easiest way is to check when you move the player if the new tile is walkable or not basd on the value, eg.
Make sense?
Waassaap!!
The easiest way of doing this is to have a simple text file like this:
10, 10, 02, 10, 10
10, 02, 02, 02, 10
10, 02, 02, 02, 10
10, 02, 02, 02, 10
10, 10, 10, 10, 10
You also have a map like this:
int Map[5][5]
You then just read the values into the map array one at a time.
As for the second question, the easiest way is to check when you move the player if the new tile is walkable or not basd on the value, eg.
Player::Move()...if (NewTile > 9) //move playerelse //don''t move player...
Make sense?
Waassaap!!
Waassaap!!
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement