Computer Science Canada

Basic, but I still need help!

Author:  Jessica43999 [ Wed Mar 22, 2006 12:26 pm ]
Post subject:  Basic, but I still need help!

Alright, this is a really basic problem... but, the turing "help" on my computer isn't working and I need help!

I am working on a 'pong' program for my gr 11/12 computer science class. And, i just can't figure out how to get a 'score' br outputted on the same line over and over again... can anyone help?! Embarassed I'm a total newbie. Crying or Very sad

Thanks, Jess.

Author:  Andy [ Wed Mar 22, 2006 12:49 pm ]
Post subject: 

locate (r,c)
put score

decide where you want the score outputted, and type it in the locate parameters, then put the score right after

Author:  NikG [ Wed Mar 22, 2006 1:47 pm ]
Post subject: 

Obviously, those two lines will have to be in your main game loop or else they'll only show once.

Also, unless you're using cls to clear the screen, you may want to write a blank at the same location after your delay to avoid weird display errors. i.e:
code:

loop
  locate(1,1)
  put score
  delay(100)
  locate(1,1)
  put "               "
end loop

Author:  Jessica43999 [ Wed Mar 22, 2006 2:18 pm ]
Post subject: 

Thanks guys!!! That totally helped allot Smile Razz

Author:  do_pete [ Wed Mar 22, 2006 2:47 pm ]
Post subject: 

NikG wrote:
Obviously, those two lines will have to be in your main game loop or else they'll only show once.

Also, unless you're using cls to clear the screen, you may want to write a blank at the same location after your delay to avoid weird display errors. i.e:
code:

loop
  locate(1,1)
  put score
  delay(100)
  locate(1,1)
  put "               "
end loop

No, this is Unnecessary because "put score" clears the entire line, whereas "put score.." doesn't

Author:  NikG [ Wed Mar 22, 2006 3:22 pm ]
Post subject: 

hmmmm good point do_pete, i forgot that. Embarassed


: