atm959

Pong BasiEgaXorz Code

Sep 26th, 2018
430
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.29 KB | None | 0 0
  1.  
  2.  
  3. OPTION TITLE, "Pong for Sega Genesis"
  4.  
  5. Palette rgb(255, 255, 255), 0, 1
  6. Palette rgb(255, 255, 0), 1, 1
  7. Palette rgb(0, 255, 255), 2, 1
  8. Palette rgb(0, 0, 255), 3, 1
  9.  
  10. dim x as integer
  11. dim y as integer
  12. dim x2 as integer
  13. dim y2 as integer
  14.  
  15. dim ballX as integer
  16. dim ballY as integer
  17.  
  18. dim velocity as integer
  19.  
  20. velocity = 5
  21.  
  22. dim points1 as long
  23. dim points2 as long
  24.  
  25. x = 128
  26. y = 128
  27.  
  28. x2 = 128 + 320 - 8
  29. y2 = 128
  30.  
  31. ballX = 128 + 100
  32. ballY = 128 + 100
  33.  
  34. 'Paddle 1
  35. s11 = addsprite(1, 1)
  36. s12 = addsprite(1, 1)
  37. s13 = addsprite(1, 1)
  38. s14 = addsprite(1, 1)
  39. s15 = addsprite(1, 1)
  40.  
  41. 'Paddle 2
  42. s21 = addsprite(1, 1)
  43. s22 = addsprite(1, 1)
  44. s23 = addsprite(1, 1)
  45. s24 = addsprite(1, 1)
  46. s25 = addsprite(1, 1)
  47.  
  48. 'The ball
  49. ball = addsprite(1, 1)
  50.  
  51. propsprite s11, 1, 1
  52. propsprite s12, 1, 1
  53. propsprite s13, 1, 1
  54. propsprite s14, 1, 1
  55. propsprite s15, 1, 1
  56.  
  57. propsprite s21, 1, 2
  58. propSprite s22, 1, 2
  59. propSprite s23, 1, 2
  60. propsprite s24, 1, 2
  61. propsprite s25, 1, 2
  62.  
  63.  
  64. propsprite ball, 1, 3
  65.  
  66. movesprite s11, x, y
  67. moveSprite s12, x, y + 8
  68. moveSprite s13, x, y + 16
  69. moveSprite s14, x, y + 24
  70. moveSprite s15, x, y + 32
  71.  
  72. moveSprite s21, x2, y2
  73. movesprite s22, x2, y2 + 8
  74. movesprite s23, x2, y2 + 16
  75. movesprite s24, x2, y2 + 24
  76. movesprite s25, x2, y2 + 32
  77.  
  78. moveSprite ball, ballX, ballY
  79.  
  80. do
  81.  
  82. if y < 128 then y = 128
  83. if y > (128 + 224) - 32 then y = (128 + 224) - (32 + 8)
  84. if y = 317 then y = 312
  85.  
  86. if y2 < 128 then y2 = 128
  87. if y2 > (128 + 224) - 32 then y2 = (128 + 224) - (32 + 8)
  88. if y2 = 317 then y2 = 312
  89.  
  90. if velocity = 2 and ballY < 128 then
  91.  
  92. velocity = 3
  93.  
  94. end if
  95.  
  96. if velocity = 3 and ballY < 128 then
  97.  
  98. velocity = 5
  99.  
  100. end if
  101.  
  102. if velocity = 5 and ballY > (128 + 224) - 8 then
  103.  
  104. velocity = 3
  105.  
  106. end if
  107.  
  108. if velocity = 4 and ballY > (128 + 224) - 8 then
  109.  
  110. velocity = 2
  111.  
  112. end if
  113.  
  114. if ballX < 128 then
  115.  
  116. ballX = 128 + 100
  117. ballY = 128 + 100
  118. movesprite ball, ballX, ballY
  119. velocity = 1
  120.  
  121. points2 = points2 + 1
  122.  
  123. end if
  124.  
  125. if ballX > 128 + 320 then
  126.  
  127. ballX = 128 + 100
  128. ballY = 128 + 100
  129. movesprite ball, ballX, ballY
  130. velocity = 1
  131.  
  132. points1 = points1 + 1
  133.  
  134. end if
  135.  
  136. locate 0, 10
  137. print points1
  138.  
  139. locate 0, 25
  140. print points2
  141.  
  142. locate 20, 5
  143. print x
  144.  
  145. locate 21, 5
  146. print y
  147.  
  148. locate 20, 15
  149. print ballX
  150.  
  151. locate 21, 15
  152. print ballY
  153.  
  154. locate 20, 25
  155. print x2
  156.  
  157. locate 21, 25
  158. print y2
  159.  
  160. if joypad(0).0 then y = y - 5
  161. if joypad(1).0 then y2 = y2 - 5
  162. if joypad(0).1 then y = y + 5
  163. if joypad(1).1 then y2 = y2 + 5
  164.  
  165. movesprite s11, x, y
  166. moveSprite s12, x, y + 8
  167. moveSprite s13, x, y + 16
  168. moveSprite s14, x, y + 24
  169. moveSprite s15, x, y + 32
  170.  
  171. moveSprite s21, x2, y2
  172. movesprite s22, x2, y2 + 8
  173. movesprite s23, x2, y2 + 16
  174. movesprite s24, x2, y2 + 24
  175. movesprite s25, x2, y2 + 32
  176.  
  177. if velocity = 1 and ballX = x + 8 and ballY > y and ballY < y + 32 then
  178.  
  179. points2 = points2 + 10000
  180. velocity = 0
  181.  
  182. end if
  183. if velocity = 0 and ballX = x2 - 8 and ballY > y2 and ballY < y2 + 32 then velocity = 1
  184. if velocity = 2 and ballX = x + 8 and ballY > y and ballY < y + 32 then velocity = 3
  185.  
  186. if velocity = 0 then ballX = ballX + 1
  187. if velocity = 1 then ballX = ballX - 1
  188. if velocity = 2 then
  189.  
  190. ballX = ballX - 1
  191. ballY = ballY - 1
  192.  
  193. end if
  194.  
  195. if velocity = 3 then
  196.  
  197. ballX = ballX + 1
  198. ballY = ballY - 1
  199.  
  200. end if
  201.  
  202. if velocity = 4 then
  203.  
  204. ballX = ballX - 1
  205. ballY = ballY + 1
  206.  
  207. end if
  208.  
  209. if velocity = 5 then
  210.  
  211. ballX = ballX + 1
  212. ballY = ballY + 1
  213.  
  214. end if
  215.  
  216. moveSprite ball, ballX, ballY
  217. sleep 1
  218.  
  219. loop
Advertisement
Add Comment
Please, Sign In to add comment