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

Author Topic: How to reset Pong ?  (Read 1286 times)

0 Members and 1 Guest are viewing this topic.

gaz99

  • Newbie
  • *
  • Posts: 7
    • View Profile
How to reset Pong ?
« on: November 25, 2011, 03:04:08 am »
Hi i've recently been using c++ and sfml and have edited the pong example to include a score to 7 and then displays the text like in the example. I wanted to add the R button to reset and it does what i want it to do apart from when it resets the win or lose text is still displaying. I tried using App.clear but that didn't work. Could anyone help me out.

Thanks

Code: [Select]

if((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::R))
{
App.Clear();

p1_score = 0;
cpu_score = 0;
AITimer.Reset();
Restart = true;


}

sbroadfoot90

  • Jr. Member
  • **
  • Posts: 77
    • View Profile
How to reset Pong ?
« Reply #1 on: November 25, 2011, 03:26:41 am »
Calling Clear on a RenderWindow just clears the screen. Read the documentation.

 

anything