Jump to content

Addictgamer's official blog

  • entries
    67
  • comments
    193
  • views
    17,480

Updates on virtual world


Addictgamer

529 views

 Share

I have rewritten the whole tile system to use a dynamic array.

For those of you who are curious, here is something like what I did, only a lot simpler.


//this keeps track of the total number of tiles that exist

int tile_num;

class tile

{

//data

}


tile *tiles[];
Now, let's say you want to draw all the tiles

//the number of tiles in a row and the next is the number of tiles in a column. These are set when the map is loaded.

int tile_num_r;

int tile_num_c;


void draw_tiles(int WX, int WY)

{

int i;

//loops through all the tiles

for (int r = 0; r < tile_num_r; ++r)

{

for (int c = 0; c < tile_num_c; ++c)

{

//draws the tile

tiles[i]->draw();

}

}

}

Anyway, I am just about done rewriting the new update code for the in-game objects.

It now uses the new tile system.

Which, by the way, is way easier to program with.

I also used a slightly modified version of this as a poorly designed method of dynamically creating objects.

Also, vote in the poll on whether or not you want me to start writing my own programming tutorials on subjects such as this.

Subjects I find no good help on on the internet.

 Share

0 Comments


Recommended Comments

There are no comments to display.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.