5 Replies - 694 Views - Last Post: 04 January 2017 - 02:21 PM Rate Topic: -----

#1 sonnyy   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 04-January 17

Simple High score in pong game

Posted 04 January 2017 - 12:54 PM

Hello Everybody.
i have a simple pong game.
i inserted a counting which does +1 when the ball hits the paddle. and i show this on screen. this works
i also already have code that exits the game when the ball misses the paddle

But now i want to save highscore.
This is precisely what i want:
- when game is over, save highscore
- only overwrite it when it's higher than the previous
- load it when game starts

just very simple, only a number. No table or best 10 or something, just 1 number that only overwrites when its higher the the previous.Im making this in Windows Forms

thanks in advance

Is This A Good Question/Topic? 0
  • +

Replies To: Simple High score in pong game

#2 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 14175
  • View blog
  • Posts: 56,780
  • Joined: 12-June 08

Re: Simple High score in pong game

Posted 04 January 2017 - 12:56 PM

Well.. StreamWriter does an amazing job at writing to a file, and streamReader does an equally excellent job reading from a file. Have you looked at those two?
Was This Post Helpful? 0
  • +
  • -

#3 andrewsw   User is offline

  • Bouncy!
  • member icon

Reputation: 6563
  • View blog
  • Posts: 26,615
  • Joined: 12-December 12

Re: Simple High score in pong game

Posted 04 January 2017 - 01:05 PM

You can use user settings to persist values between sessions. That is, if the high score is per user.
Was This Post Helpful? 0
  • +
  • -

#4 sonnyy   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 04-January 17

Re: Simple High score in pong game

Posted 04 January 2017 - 01:39 PM

View Postmodi123_1, on 04 January 2017 - 12:56 PM, said:

Well.. StreamWriter does an amazing
job at writing to a file, and streamReader does an equally excellent job reading from a file.
Have you looked at those two?

I see Reader and Writer but i dont know how use it . Can u write me example . Im making this in windows forms and i wanna make highscore.txt and just load every time
Was This Post Helpful? 0
  • +
  • -

#5 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 14175
  • View blog
  • Posts: 56,780
  • Joined: 12-June 08

Re: Simple High score in pong game

Posted 04 January 2017 - 01:42 PM

The MSDN docs have amazingly concise and clear examples. Check those out.
Was This Post Helpful? 0
  • +
  • -

#6 Skydiver   User is offline

  • Code herder
  • member icon

Reputation: 6292
  • View blog
  • Posts: 21,622
  • Joined: 05-May 12

Re: Simple High score in pong game

Posted 04 January 2017 - 02:21 PM

How are you "seeing" those? IntelliSense? If so, use IntelliSense as a hint. Take time to read the documentation in MSDN.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1