Help loading a map text file

Started by
22 comments, last by kingpinzs 18 years, 11 months ago
So what is the best method to animate tiles?



this is what I was thinking

void draw()
{
for(int layer = 0; layer <3; layer++){
for(int row = 0; row <MapY; row++){
for(int column = 0;column < MapX; column++){

int TileNum=map[layer][row][column];

if(TileNum == 1){
Animate();}
DrawFunction;

}
}
}

}


first I need to make the pointer to the animated tiles a vector or array so if it its any tiles that is spouse to be anmited the it will animate them instead of making an if statment for each one

and Is there I better way to do this?

Advertisement
So no one knows how to make animated tiles?
Your questions are too general, making them hard to answer.

But to animate a tile, you need to change the image of the sprite once a certain amount of time has past. Each frame can have different amounts of time it should be displayed, or all frames could be displayed for something like 100ms.
Can some one then explain how animation is spouse to work for the tiles? I can animate a sprite but I have the tiles in a array and it just sends it to the back buffer. I know I have to define which tile id's I want to be animated but after that how whould I jump to another function in the middle of my tile display to tell it to loop through a set of tiles to animte tile id 4 or something like that. I need it so that if (tileid >= 10) then animate all those with there own animation. and I am guessing you could use the same prosses to find the tiles that can not be walked on. so I just need to animate the tiles and I will have a lot done.

I figure you might do something like but also there needs to be a timmer in there some were so it does not display the tiles to fast. What would the timer look like that could acomplish that?

void draw(){     for (int layer = 0; layer < 3; layer++)    {        for(int row = 0; row < Mapy; row++)        {            for(int column = 0; column < Mapx; column++)            {              int TileNum=map[layer][row][column];                                if (TileNum <=5)                { animate(TileNum);}                if (TileNum == 2)                {collition(TileNum);}                                fout <<TileNum ;                            }        fout<<"\n";        }    fout<< "map sector L:" << layer<< "\n";     }}


Let me know if I am incorrect.

Thanks for the help so far.

This topic is closed to new replies.

Advertisement