Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: why does this not work i read multiple posts still doesnt work  (Read 4671 times)

0 Members and 1 Guest are viewing this topic.

codingHere

  • Newbie
  • *
  • Posts: 6
    • View Profile
why does this not work i read multiple posts still doesnt work
« on: October 09, 2021, 02:42:17 am »
why does this not work???

   if (Keyboard::isKeyPressed(Keyboard::Enter))
                {
                    gameNotStarted = false;
                }
        // set the color
        text.setFillColor(Color::White);
       
        //position the text
        FloatRect textRect = text.getLocalBounds();

        text.setOrigin(textRect.width / 2.0f, textRect.top + textRect.height / 2.0f);
        text.setPosition(7200 / 3.4f, 1000 / 2.0f);

       


       


        window.clear();
        //draw here
        if (gameNotStarted = true)
        {
            window.draw(text);
        }

codingHere

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: why does this not work i read multiple posts still doesnt work
« Reply #1 on: October 09, 2021, 02:54:36 am »
nevermind i figured this out   :P i realized that this part is wrong:

if (gameNotStarted = true)
        {
            window.draw(text);
        }

its suppose to be like this:

if (gameNotStarted)
        {
            window.draw(text);
        }

fallahn

  • Hero Member
  • *****
  • Posts: 507
  • Buns.
    • View Profile
    • Trederia
Re: why does this not work i read multiple posts still doesnt work
« Reply #2 on: October 09, 2021, 10:46:19 am »
As a side note a comparison should be

    gameNotStarted == true

not

    gameNotStarted = true

 otherwise you're just assigning the value of true to the variable.

codingHere

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: why does this not work i read multiple posts still doesnt work
« Reply #3 on: October 14, 2021, 04:48:05 am »
thx!  :)

 

anything