Hey there,
in my game, when i blast a balloon (with an object inside of it) the object begins to drop, and the balloon that had been blasted gets a new random position (without another object). Now that i wanted to do add a new object when balloon is poped, i resized my vector <Object> and initialize it with Image, positions, etc. Now when i pop a any balloon, all objects seem not to have any image with them :roll: they appear transparent. But if i dont add that resize of the vector the game works fine (without the new object when balloon pop).
balloon[i].SetIsAlive(false);
object[i].Drop = true;
object[i].BalloonIndex = i;
GenBalloons(i, balloon);
works fine
balloon[i].SetIsAlive(false);
object[i].Drop = true;
object[i].BalloonIndex = i;
GenBalloons(i, balloon);
//-----------------
object.resize(object.size() + 1);
if (!object[object.size() - 1].Image.LoadFromFile("main\\object1.png"))
return 1;
object[object.size() - 1].Sprite.SetImage(object[object.size() - 1].Image);
object[object.size() - 1].Sprite.SetCenter(object[object.size() - 1].Sprite.GetSize().x / 2, object[object.size() - 1].Sprite.GetSize().y / 2);
object[object.size() - 1].Sprite.SetPosition((balloon[i].Sprite.GetPosition().x - object[object.size() - 1].Sprite.GetPosition().x) / 2, (balloon[i].Sprite.GetPosition().y - object[object.size() - 1].Sprite.GetPosition().y) / 2);
object[object.size() - 1].Drop = false;
object[object.size() - 1].SetIsAlive(true);
object[object.size() - 1].BalloonIndex = i;
object[object.size() - 1].SetSpeed(object[i].GetSpeed());
doesnt work fine
Window.Draw()
for (int i=0;i<BALLOONINDEX;i++)
{
//if (object[i].Drop == true && ObjectColHand(i, object, hand) == false)
Window.Draw(object[i].Sprite);
}