1
Graphics / Help with Sprites and Vectors [Newbie]
« on: February 03, 2011, 05:40:55 pm »Quote from: "Groogy"
Also you want to avoid pointers, especially pointers to heap memory(memory gained through the new operator.)
Where do you do the call to the method of Tile that crashes? That pointer to the object used in the call where do you assign a value to it?
i wasnt using pointers at first , all i did was create a new Tile object , and in Tile.cpp in my constructor i initialize a vector<sf::Sprite> and i have a sprite object called sprit , i would iterate through my spritesheet cutting it into 16x16 tiles and storing each tile sprite into the vector .
Then in settype(should be called DrawTiles()) i tried to fill the screen with the tile in vector[60].
also i read somwhere that you had to push pointers to the sprites onto the vector , or it might remove everything in previous vector positions.