Hello guys I am working on a maze game with c++ and sfml gui [closed]

  c++, dev-c++, sfml, user-interface

I have rendered the window display,inluded the libraries, have created the maze,the player and the opponent but when i try to include some rocks you can collect, nothing appears on the gui window. Any clues?? Here is the code:

sf::CircleShape rocks [5];
    int numRocks = 0;
          .
          .
          .
while(numRocks < 3){
            int col = (std::rand() / (float) RAND_MAX) * 15.f;
            int row = (std::rand() / (float) RAND_MAX) * 15.f;
    
            if(gameMap[col + row * 15] == 0){
                gameMap[col + row * 15] = 2;
                rocks[numRocks].setPosition(col * 40.f, row * 40.f);
                rocks[numRocks].setRadius(15.f);
                rocks[numRocks].setFillColor(sf::Color(128,128,128));
                rocks[numRocks].setOutlineThickness(1.f);
                rocks[numRocks].setOutlineColor(sf::Color(0,0,0));
            
            }
        }

If i put the while code block as comment the rendering is fine and the player and opponent appear just fine, I can even control the player. Any suggestions?

I can provide the whole programm for more information.

Source: Windows Questions C++

LEAVE A COMMENT