I have a 2 classes. I have a tower class and I have a monster class. The default constructor automatically sets a position for the tower. I store the classes in a vector and run a function that returns the value of the towers x position. I can clearly see on my screen that the tower is not in the 0,0 coordinate, but it says it is anyway.
void checkcolission(TowerA tower)
{
if (tower.getLeft() > monsterSprite.getPosition().x) /*&& tower.getTop() < monsterSprite.getPosition().y && tower.getBottom() > monsterSprite.getPosition().y*/
{
//std::cout << "#($)(#%*#%U#*(%*#%*#%" << std::endl;
}
std::cout << tower.getPositionX() << std::endl;
}
public://in my tower class
TowerA()
{
spritetower1.setPosition(100, 50);
towerRange.setPosition(getPositionX(), getPositionY());
}
//This is in my game class with push_backed vectors of the class
for (int i = 0; i < mymonsters.size(); i++)
{
for (int k = 0; k < myicetower.size(); k++)
{
mymonsters[i].checkcolission(myicetower[k]);
}
}