Hi I seem to be having some trouble with function in my code. The idea is that I have an array and I want to swap the order of the array around. Everytime I run the function though it just comes up with a assert error and closes. It also doesn't do what the function is meant to do.
Code:
void TriBlock::Shuffel()
{
// Create temporary blocks to do the sorting
Block * tempBlock = itsBlocks;
// Chage the position of the temporary blocks
tempBlock[0].setItsY((tempBlock[0].getItsY())+32);
tempBlock[1].setItsY((tempBlock[1].getItsY())+32);
tempBlock[2].setItsY((tempBlock[2].getItsY())-64);
// Assert them back into the array in the new order
itsBlocks[0] = tempBlock[2];
itsBlocks[1] = tempBlock[0];
itsBlocks[2] = tempBlock[1];
delete[] tempBlock;
}
Here is the class definition as well if it helps
Code:
class TriBlock
{
public:
// Constructor Destructor
TriBlock();
~TriBlock();
// Initalize the actual Block
void CreateBlock();
// Basic Accessors
void SetBlock(int blockNo, Block &theBlock);
Block getBlock(int blockNo);
// Other methods
void Shuffel();
void CollisionCheck();
void Move();
void Increment();
void Draw();
private:
Block * itsBlocks;
};