Hello everyone!
Right now im programming on a little spaceshooter. Every time the player shoots a sprite should be generated from the same image. But my compiler keeps telling me that: main.cpp:166: error: expected primary-expression before "Shot"
Here is part of the code:
sf::Image IShot;
if (!IShot.LoadFromFile("Shot.png")) {
// Error...
}
std::vector<sf::Sprite> ShotVector;
Gameloop:
// SHOOTING
shotTimer++;
if (Game.GetInput().IsKeyDown(sf::Key::N) && shotTimer > 60) {
shotTimer = 0;
shot = true;
}
if (shot) {
shot = false;
sf::Sprite Shot;
Shot.SetImage(IRocketP1);
Shot.SetColor(sf::Color(255, 255, 255, 255));
Shot.SetPosition(350.f, 600.f);
Shot.SetCenter(Shot.GetSize().x / 2, Shot.GetSize().y / 2);
ShotVector.push_back(Shot); <--- LINE 166
}
int i = 0;
for (i = 0; i < ShotVector.size(); i++) {
Game.Draw(ShotVector[i]);
}