
-----------------------------------
BreeG16
Fri Jun 13, 2008 6:39 pm

Pong help :s I've never programmed in my life.
-----------------------------------
-Hmmm, so, I got put into a computer science course because not enough ppl signed up for architecture. And I've never done any programming ever. So for my ISU/exam I'm trying to make something simple: pong.

WriteScore
    if player (2).score > 11 then   %Declares player2's name as winner when their score is above 11.
        put "player2 Wins!"
    end if
    if player (1).score > 11 then      %Declares player1's name as winner when the score is above 11.
        put "player1 Wins!"
    end if
    exit when player (2).score > 11    %Stops the game when one of the players wins
    exit when player (1).score > 11
    View.Update
end loop


-Everytime a player wins and "Player# Wins!" is displayed on the screen it isn't written inside the score box with the rest of the score stuff, it skips down a line and is written right at the left side of the screen. How do i get it in the score box? I'm not really sure how to word this better.

PS. please don't make any comments/explanations too complicated. You programmers frighten me.

-----------------------------------
Tony
Fri Jun 13, 2008 6:54 pm

RE:Pong help :s I\'ve never programmed in my life.
-----------------------------------
can't say for sure, since you did not post the contents of the WriteScore procedure, but I will assume it's something along the lines of


locate(1,1)
put "score is: " + variable


But Turing adds the new line character to the end of every put statement by default, this is what's causing the next "put" (in this case Player# Wins) to go to the next line. So you can either use the same way of positioning as you've done in the WriteScore procedure, to reposition the cursor (where text appears). Or you could drop the new-line with double-dot ..

locate(1,1)
put "score is: " + variable + ""..


-----------------------------------
BreeG16
Sat Jun 14, 2008 9:36 am

Re: Pong help :s I've never programmed in my life.
-----------------------------------
thanks, i tried that whole locate thing and while it took me a million tries to get it right, i finally got it working.

 :wink:  'preciate it!
