Jump to content
  • Advertisement

Archived

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

Gak

Some tile-based engine q's

This topic is 6911 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

I have some questions relating to tile-based game engines. 1) How do I split the screen up into squares and efficiently put bitmaps into each square. I have done this already, but 64 (8x8) surfaces is stoopid! 2) How do I set flags for a tile along the lines of: flags = WALKABLE / ITEM / TILEID_GRASS; etc... Cheers for any help ppl!

Share this post


Link to post
Share on other sites
Advertisement
You may want to download my tile engine source code at http://www.untergrund-spiele.de/mainstream/downloads/tileengine.zip - It shows how to load your tiles into one surface and calculate the RECTs for any tile.

Share this post


Link to post
Share on other sites
Or you try www.remagination.com and then Tutorials.
Joscha

The last truth is that there is no magic(Feist)

Share this post


Link to post
Share on other sites
Answers:

1) it''s spelled "stupid" . Anyway, building an array of MxN is your only option, pretty much. 64 Bytes isn''t that much . Heck, 64KB isn''t that much. Dont worry about it. Tile maps taking up too much memory isn''t something which happens often .

2) Sort of ugly. Basically, you need to do something like this:

#define Flag1 0x01
#define Flag2 0x02
#define Flag3 0x04
#define Flag4 0x08

As you probably know, to fill a flag variable you do this:
flag = Flag1 / Flag3; //sets on flags 1 and 3

To read back the values, though, you do this:

/* code reads out value of flag 1, to read value of any other flag you''d just substitute it''s flag there */
flagvalue = Flag1 & flagsvariable;

--TheGoop

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!