Skip to main content
gamedev.net
🔒 Locked

Creating dynamic tile maps

Started by darkchrono4 Jan 23, 2005 at 1:32 PM 1 replies 400+ views
Original Post
darkchrono4
darkchrono4
There is an article about this on GameDev. But it seems to have typos in type defining of mallocs(). It should be using the size of MAPTILE and not int?
Sneftel
Sneftel
Each article has a specific thread for feedback, which you can access by clicking "discuss this article in the forums"; you should post this there. You may also want to contact the author directly.
Jiia
Jiia
struct MapTile{  int Image;  int blah;};struct MapType{  int Width,Height;  MapTile *Tiles;  VOID CreateMap(int width, int height) { Width = width; Height = height; Tiles = new MapTile[Width * Height]; }  VOID FreeMap() { delete [] Tiles; }  MapTile* GetTile(int x, int y) { return Tiles + x + (y * Width); }};MapType MyMap;MyMap.CreateMap( 20, 20 );MyMap.GetTile(5,10)->blah = TRUE;

[disturbed]

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.