Advertisement
Spyder68

Pong for Ti-84 Plus CE source-code with explanation

May 8th, 2019
608
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. ClrHome //Clear The Home Screen
  2. 3→A:1→X:3→Y //Sets The Paddle X coordinate to 3, and sets the ball coordinates
  3. 1→S:1→T:0→R //Sets the ball directions to positive, and sets score to 0
  4. Repeat K=45 or Y=10 and not(A≤X and A+2≥X //Repeats the loop until keypress=clear or ball touches ground without paddle
  5. Output(Y,X,"O //outputs the ball
  6. getKey→K //senses if there is a keypress
  7. If K=24 or K=26 //if the keypress is left or right arrow
  8. Output(10,A," //(3 spaces) deletes the paddle from the screen for a split second to relocate it
  9. max(1,min(24,A+2(K=26)-2(K=24→A //sets paddle boundaries and stores a new coordinate for the paddle if left or right arrow was pressed
  10. Output(10,A,"--- //outputs the paddle
  11. T(Y>1 and Y<10)+(Y=1)-(Y=10→T //sets the Y direction of the ball
  12. S(X>1 and X<26)+(X=1)-(X=26→S //sets the X direction of the ball
  13. Output(Y,X," //(one space) takes ball of screen to relocate it with new coordinates
  14. X+Ans→X:Y+T→Y //adds positive or negative values to the ball's coordinates
  15. R+1→R //adds one to the score
  16. End //end of the loop,so the cpu jumps back to "repeat"
  17. Disp "SCORE:",R //displays score
  18. Pause "GAME OVER! //displays "game over" at the same time of it pausing the program
  19. ClrHome:" //clears home screen and " prevents the "Done" message from being displayed (for cleanliness of program)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement