It looks like this:
Code: Select all
Tile t;
t.setX(k*32);
map.at(i).at(j) = t; //problem here!!
Code: Select all
vector<vector<Tile> > map;
Moderator: Coders of Rage
Code: Select all
Tile t;
t.setX(k*32);
map.at(i).at(j) = t; //problem here!!
Code: Select all
vector<vector<Tile> > map;
Ducky wrote:Give a man some wood, he'll be warm for the night. Put him on fire and he'll be warm for the rest of his life.
You know, you guys should get in the habit of using a little debugging tool that will help you immensely. Every time you load a file, allocate data, or anything else that might cause a system crash (seg fault?), USE YOUR BRAINS!!! hahaha, okay, okay, I'm just kidding.loads a level from a text file. By lots of cout's i have tracked down the line that is causing the program to shut down
Code: Select all
#include <stdio.h>
int main (int argc, char * const argv[]) {
if( !load_this_shit("tiledata.dat") ) printf("Fucked up at line: %d", __LINE__);
return 0;
}
I realized the moment I fell into the fissure that the book would not be destroyed as I had planned.
I dont know if it is a good way to do it in, but the position in my simulated 2D array, dicides where the tiles is located on the map. The x and y coordinate in my tile class just shows where on the tilesheet they are.Ginto8 wrote: Why are you doing a vector of vectors? Are you doing an accumulated vector that includes every single level? 'cuz if it's just one level, all you need is a vector of tiles. Different vectors for different layers (if you're doing layers).
Here's an idea: make the x and y of the tile the x and y in TILES. When drawing them, just multiply the x and y by the width/height of the tiles. It'll make them easier to manage, methinks.ismetteren wrote:I dont know if it is a good way to do it in, but the position in my simulated 2D array, dicides where the tiles is located on the map. The x and y coordinate in my tile class just shows where on the tilesheet they are.Ginto8 wrote: Why are you doing a vector of vectors? Are you doing an accumulated vector that includes every single level? 'cuz if it's just one level, all you need is a vector of tiles. Different vectors for different layers (if you're doing layers).
And thanks marauder. :D
Ducky wrote:Give a man some wood, he'll be warm for the night. Put him on fire and he'll be warm for the rest of his life.
I realized the moment I fell into the fissure that the book would not be destroyed as I had planned.