Advertisement
Guest User

Untitled

a guest
Feb 14th, 2023
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.82 KB | None | 0 0
  1. //02/14/23 v1.1
  2. 15->W //speed of asteroids - set to a factor of 150
  3. ClrHome
  4. 2->X //player X
  5. 5->Y //player Y
  6. 3->L //starting live #
  7. 0->S //resets score
  8. ">"->Str1 //player sprite
  9. "*"->Str2 //asteroid sprite
  10. 16-round(0/10,0)->R //sets initial asteroid X posistion
  11. randInt(2,8)->E //sets initial asteroid Y posistion
  12. getKey->K
  13. 0->N //resets loop variable
  14. Repeat K=45 or L<=0
  15. If Y=E and X=R //collision for player and asteroid
  16. Then
  17. 0->N
  18. randInt(2,8)->E
  19. S+1->S //increases score
  20. End
  21. E->Q //stores asteroid Y pos before it is set for the frame
  22. If N>=150 //resets loop once it is 150 (touches the left of the screen)
  23. Then
  24. 0->N
  25. randInt(2,8)->E
  26. L-1->L
  27. End
  28. getKey->K
  29. Y->F //stores player Y pos before it is set for the frame
  30. If K!=0 //key detection 25 is up 34 is down (sets player Y)
  31. Then
  32. If K=25
  33. Then
  34. If Y>2
  35. Then
  36. Y-1->Y
  37. End
  38. Else
  39. If K=34
  40. Then
  41. If Y<8
  42. Then
  43. Y+1->Y
  44. End
  45. End
  46. End
  47. End
  48. N+W->N //increases loop by speed (W)
  49. R->O //sets asteroid X pos before it is set for the frame
  50. 16-round(N/10,0)->R //sets asteroid X posistion
  51. If O!=R or F!=Y or Q!=E //checks for any changes in posistion from the last frame
  52. Then
  53. If Q!=E
  54. Then
  55. Output(Q,O," ") //clears old asteroid posistion when it reaches the end
  56. End
  57. If O!=R
  58. Then
  59. Output(E,O," ") //clears old asteroid posistion
  60. End
  61. If F!=Y
  62. Then
  63. Output(F,X," ") //clears old player posistion
  64. End
  65. Output(Y,X,Str1)
  66. Output(E,R,Str2)
  67. For(I,1,3) //displays lives
  68. If I<=L
  69. Then
  70. Output(1,I+12,Str1)
  71. Output(1,L+13," ")
  72. // Output(1,L+13," ")
  73. End
  74. End
  75. Output(1,2,S) //displays score
  76. End
  77. End
  78. ClrHome
  79. Output(4,4,"GAME OVER") //game over screen
  80. Output(3,5,"SCORE=")
  81. Output(3,11,S)
  82. " //prevents DONE from appearing when the program finishes
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement