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

Author Topic: How to add scoring?  (Read 1782 times)

0 Members and 1 Guest are viewing this topic.

Girby2K11

  • Newbie
  • *
  • Posts: 24
    • View Profile
How to add scoring?
« on: June 06, 2011, 05:29:48 pm »
Hi, i am wondering how to add a scoring thing e.g. when i tap space, it adds 1 to the score.

I was using this method. Text.SetText(score);
but that seems to have failed. I am quite confused.
I'm tring to learn SFML Help? Collision?

Jove

  • Full Member
  • ***
  • Posts: 114
    • View Profile
    • http://www.jestofevekites.com/
How to add scoring?
« Reply #1 on: June 06, 2011, 06:20:50 pm »
I looked into this a while back and after some Googling came up with this :

Code: [Select]

std::stringstream ss;
std::string score_string;

ss << gamescore;
ss >> score_string;

scoretext.SetText(score_string);

App.Draw(scoretext);


Works just fine...hope it helps you.
{much better code}

Girby2K11

  • Newbie
  • *
  • Posts: 24
    • View Profile
How to add scoring?
« Reply #2 on: June 06, 2011, 08:01:41 pm »
Thanks. Going to test now.
I'm tring to learn SFML Help? Collision?

 

anything