Advertisement
Audiation

Wormed

Jul 30th, 2013
315
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ' Wormed by Logan G. / "TheBaykun"
  2. ' Try to survive as long as you can without
  3. ' hitting any obstacles!
  4.  
  5. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  6. Settings:
  7. '''''''''''''''''''''''
  8. Dots = 700        '0 - 1000.
  9. DotSize = 2       '1 - 10.
  10. Walls = 0           '1: On, 2: Off.
  11. WallWidth = 2
  12. RETINA on
  13. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  14.  
  15. speed=wallwidth 'This is actually the width of the walls, not speed.
  16. LOADSPRITE 1, "dpad"
  17. SLEEP 0.01
  18. sw=ScreenWidth
  19. sh=ScreenHeight
  20. TCOLOR 0,200,20
  21. SLEEP 0.01
  22. IF speed<1 THEN
  23.     speed=1
  24. ENDIF
  25. IF speed>10 THEN
  26.     speed=10
  27. ENDIF
  28. IF dots<0 THEN
  29.     dots=0
  30. ENDIF
  31. IF dots>1000 THEN
  32.     dots=1000
  33. ENDIF
  34. IF dotsize<1 THEN
  35.     dotsize=1
  36. ENDIF
  37. IF dotsize>10 THEN
  38.     dotsize=10
  39. ENDIF
  40. SLEEP 0.01
  41. IF walls=1 THEN
  42.     BCOLOR 255,255,255
  43.     SLEEP 0.01
  44.     COLOR 50,50,50
  45.     RECT speed*2,speed*2,sw-(speed*2),sh-(speed*2)
  46.     x=((speed*2)+20)+(RND*(sw-(2*((speed*2)+20))))
  47.     y=((speed*2)+20)+(RND*(sh-(2*((speed*2)+20))))
  48.     COLOR 255,0,0
  49.     SLEEP 0.01
  50.     CIRCLE x,y,15,2
  51.     COLOR 255,255,255
  52.     FOR i=1 TO dots
  53.         CIRCLE (speed*2)+(RND*(sw-(2*speed))),(speed*2)+(RND*(sh-(2*speed))),dotsize
  54.     NEXT
  55. ELSE
  56.     BCOLOR 50,50,50
  57.     x=20+(RND*(sw-20))
  58.     y=20+(RND*(sh-20))
  59.     COLOR 255,0,0
  60.     SLEEP 0.01
  61.     CIRCLE x,y,15,2
  62.     COLOR 255,255,255
  63.     FOR i=1 TO dots
  64.         CIRCLE 1+(RND*sw),1+(RND*sh),dotsize
  65.     NEXT
  66. ENDIF
  67.  
  68. SLEEP 0.01
  69. DRAWSPRITE 1, sw-180-(2*speed),sh-120-(2*speed),6
  70. SLEEP 0.01
  71. d=INT(1+(RND*4))
  72. DIM dirTriX(3)
  73. DIM dirTriY(3)
  74. IF d=1 THEN 'Left.
  75.     dirTriX(1)=x-19
  76.     dirTriY(1)=y
  77.     dirTriX(2)=x-15
  78.     dirTriY(2)=y-2
  79.     dirTriX(3)=x-15
  80.     dirTriY(3)=y+2
  81. ENDIF
  82. IF d=2 THEN 'up
  83.     dirTriX(1)=x
  84.     dirTriY(1)=y-19
  85.     dirTriX(2)=x-2
  86.     dirTriY(2)=y-15
  87.     dirTriX(3)=x+2
  88.     dirTriY(3)=y-15
  89. ENDIF
  90. IF d=3 THEN 'right
  91.     dirTriX(1)=x+19
  92.     dirTriY(1)=y
  93.     dirTriX(2)=x+15
  94.     dirTriY(2)=y-2
  95.     dirTriX(3)=x+15
  96.     dirTriY(3)=y+2
  97. ENDIF
  98. IF d=4 THEN 'down
  99.     dirTriX(1)=x
  100.     dirTriY(1)=y+19
  101.     dirTriX(2)=x-2
  102.     dirTriY(2)=y+15
  103.     dirTriX(3)=x+2
  104.     dirTriY(3)=y+15
  105. ENDIF
  106. SLEEP 0.01
  107. COLOR 50,50,50
  108. RECT x-20,y-20,x+20,y+20
  109. COLOR 255,0,0
  110. SHAPE 3,dirTriX,dirTriY
  111. TEXTFONT "Arial Rounded","Bold",12
  112. DRAWTEXT "3",x-4,y-6
  113. SLEEP 1
  114. COLOR 50,50,50
  115. RECT x-6,y-6,x+6,y+6
  116. COLOR 255,0,0
  117. DRAWTEXT "2",x-4,y-6
  118. SLEEP 1
  119. COLOR 50,50,50
  120. RECT x-6,y-6,x+6,y+6
  121. COLOR 255,0,0
  122. DRAWTEXT "1",x-4,y-6
  123. SLEEP 1
  124. COLOR 50,50,50
  125. RECT x-20,y-20,x+20,y+20
  126. COLOR 255,0,0
  127. CLS tty
  128. pts=0
  129. loopA:
  130. 'BEGINDRAW
  131.  
  132. IF x<0 THEN
  133.     x=Sw
  134. ENDIF
  135. IF x>sw THEN
  136.     x=0
  137. ENDIF
  138. IF y<0 THEN
  139.     y=sh
  140. ENDIF
  141. IF y>sh THEN
  142.     y=0
  143. ENDIF
  144.  
  145. pts=pts+1
  146. POINT x,y
  147. CLS tty
  148. PRINT pts
  149.  
  150. IF Touch>=1 THEN
  151.     IF TouchX>=sw-60-(2*speed) AND TouchY>=sh-60-(2*speed) AND d<>1 THEN
  152.         d=3
  153.     ENDIF
  154.     IF TouchX>=sw-120-(2*speed) AND TouchY>=sh-60-(2*speed) AND TouchX<sw-60-(2*speed) AND d<>2 THEN
  155.         d=4
  156.     ENDIF
  157.     IF TouchX>=sw-180-(2*speed) AND TouchY>=sh-60-(2*speed) AND TouchX<sw-120-(2*speed) AND d<>3 THEN
  158.         d=1
  159.     ENDIF
  160.     IF TouchX>=sw-120-(2*speed) AND TouchY>=sh-120-(2*speed) AND TouchX<sw-60-(2*speed) AND TouchY<sh-60-(2*speed) AND d<>4 THEN
  161.         d=2
  162.     ENDIF
  163. ENDIF
  164.  
  165. IF d=1 THEN 'left
  166.     xa=-1
  167.     ya=0
  168. ENDIF
  169. IF d=2 THEN 'up
  170.     xa=0
  171.     ya=-1
  172. ENDIF
  173. IF d=3 THEN 'right
  174.     xa=1
  175.     ya=0
  176. ENDIF
  177. IF d=4 THEN 'down
  178.     xa=0
  179.     ya=1
  180. ENDIF
  181. x=x+xa
  182. y=ya+y
  183. SLEEP 0.02
  184. READPIXEL x+xa,y+ya
  185. 'ENDDRAW
  186. IF ReadPixelR<=200 THEN
  187.     GOTO loopA
  188. ENDIF
  189. OPEN "wormedData" FOR INPUT AS #1
  190. INPUT #1, hiScore
  191. CLOSE #1
  192. IF pts>hiScore THEN
  193.     hiScore=pts
  194. ENDIF
  195. OPEN "wormedData" FOR OUTPUT AS #1
  196. PRINT #1, hiScore
  197. CLOSE #1
  198. PRINT "Highscore:",hiScore
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement