Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

OoMMMoO

tle based engine help

This topic is 6414 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
Advertisement
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.


Player::Move()
...
if (NewTile > 9)
//move player
else
//don''t move player
...


Make sense?

Waassaap!!

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!