Advertisement
Guest User

smallbasic problem

a guest
Feb 1st, 2018
959
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.34 KB | None | 0 0
  1. GraphicsWindow.Show()
  2. GraphicsWindow.Height=600
  3. GraphicsWindow.Width=800
  4. GraphicsWindow.CanResize="FALSE"
  5. '+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+='
  6. GraphicsWindow.BackgroundColor="#a5a5a5"
  7. GraphicsWindow.PenColor="Black"
  8. GraphicsWindow.DrawRectangle(1, 1, 400, 400)
  9. '+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+='
  10. CursorX = 0
  11. CursorY = 0
  12. Colour = "Black"
  13. '+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+='
  14. GraphicsWindow.BrushColor="Blue"
  15. GraphicsWindow.FillRectangle(450, 100, 20, 20)
  16. GraphicsWindow.FillRectangle(480, 100, 20, 20)
  17. GraphicsWindow.FillRectangle(510, 100, 20, 20)
  18. GraphicsWindow.FillRectangle(540, 100, 20, 20)
  19. GraphicsWindow.BrushColor="Black"
  20. GraphicsWindow.FillTriangle(460, 70, 450, 90, 470, 90)
  21. GraphicsWindow.FillTriangle(490, 90, 480, 70, 500, 70)
  22. GraphicsWindow.FillTriangle(540, 90, 540, 70, 560, 80)
  23. GraphicsWindow.FillTriangle(530, 90, 530, 70, 510, 80)
  24.  
  25. GraphicsWindow.BrushColor="Blue"
  26. GraphicsWindow.FillRectangle(480, 140, 20, 20)
  27. GraphicsWindow.FillRectangle(510, 140, 20, 20)
  28. GraphicsWindow.BrushColor="Black"
  29. GraphicsWindow.FillRectangle(480, 130, 14, 5)
  30. GraphicsWindow.FillTriangle(495, 130, 495, 135, 500, 132.5)
  31. GraphicsWindow.FillRectangle(510, 125, 14, 10)
  32. GraphicsWindow.FillRectangle(525, 125, 5, 10)
  33.  
  34. GraphicsWindow.BrushColor="#000000"
  35. GraphicsWindow.PenColor="#000000"
  36. GraphicsWindow.FillRectangle(450, 200, 20, 20)
  37. GraphicsWindow.BrushColor="#282828"
  38. GraphicsWindow.PenColor="#282828"
  39. GraphicsWindow.FillRectangle(480, 200, 20, 20)
  40. GraphicsWindow.BrushColor="#757575"
  41. GraphicsWindow.PenColor="#757575"
  42. GraphicsWindow.FillRectangle(510, 200, 20, 20)
  43. GraphicsWindow.BrushColor="#ffffff"
  44. GraphicsWindow.PenColor="#ffffff"
  45. GraphicsWindow.FillRectangle(540, 200, 20, 20)
  46. GraphicsWindow.BrushColor="#ff0000"
  47. GraphicsWindow.PenColor="#ff0000"
  48. GraphicsWindow.FillRectangle(450, 230, 20, 20)
  49. GraphicsWindow.BrushColor="#ff7700"
  50. GraphicsWindow.PenColor="#ff7700"
  51. GraphicsWindow.FillRectangle(480, 230, 20, 20)
  52. GraphicsWindow.BrushColor="#ffff00"
  53. GraphicsWindow.PenColor="#ffff00"
  54. GraphicsWindow.FillRectangle(510, 230, 20, 20)
  55. GraphicsWindow.BrushColor="#00ff00"
  56. GraphicsWindow.PenColor="#00ff00"
  57. GraphicsWindow.FillRectangle(540, 230, 20, 20)
  58.  
  59. GraphicsWindow.BrushColor="#c92020"
  60. GraphicsWindow.PenColor="#c92020"
  61. GraphicsWindow.FillRectangle(450, 260, 20, 20)
  62. GraphicsWindow.BrushColor="#db6900"
  63. GraphicsWindow.PenColor="#db6900"
  64. GraphicsWindow.FillRectangle(480, 260, 20, 20)
  65. GraphicsWindow.BrushColor="#dbab00"
  66. GraphicsWindow.PenColor="#dbab00"
  67. GraphicsWindow.FillRectangle(510, 260, 20, 20)
  68. GraphicsWindow.BrushColor="#09b72e"
  69. GraphicsWindow.PenColor="#09b72e"
  70. GraphicsWindow.FillRectangle(540, 260, 20, 20)
  71.  
  72. GraphicsWindow.BrushColor="#45e3ef"
  73. GraphicsWindow.PenColor="#45e3ef"
  74. GraphicsWindow.FillRectangle(450, 290, 20, 20)
  75. GraphicsWindow.BrushColor="#4586ef"
  76. GraphicsWindow.PenColor="#4586ef"
  77. GraphicsWindow.FillRectangle(480, 290, 20, 20)
  78. GraphicsWindow.BrushColor="#c034f9"
  79. GraphicsWindow.PenColor="#c034f9"
  80. GraphicsWindow.FillRectangle(510, 290, 20, 20)
  81. GraphicsWindow.BrushColor="#ef45d5"
  82. GraphicsWindow.PenColor="#ef45d5"
  83. GraphicsWindow.FillRectangle(540, 290, 20, 20)
  84.  
  85. GraphicsWindow.BrushColor="#189999"
  86. GraphicsWindow.PenColor="#189999"
  87. GraphicsWindow.FillRectangle(450, 320, 20, 20)
  88. GraphicsWindow.BrushColor="#1d29ad"
  89. GraphicsWindow.PenColor="#1d29ad"
  90. GraphicsWindow.FillRectangle(480, 320, 20, 20)
  91. GraphicsWindow.BrushColor="#aa0f90"
  92. GraphicsWindow.PenColor="#aa0f90"
  93. GraphicsWindow.FillRectangle(510, 320, 20, 20)
  94. GraphicsWindow.BrushColor="#691291"
  95. GraphicsWindow.PenColor="#691291"
  96. GraphicsWindow.FillRectangle(540, 320, 20, 20)
  97.  
  98. GraphicsWindow.BrushColor="Blue"
  99. GraphicsWindow.PenColor="Blue"
  100. GraphicsWindow.FillRectangle(20, 440, 20, 20)
  101. GraphicsWindow.FillRectangle(50, 440, 20, 20)
  102. GraphicsWindow.BrushColor="#000000"
  103. GraphicsWindow.PenColor="#000000"
  104. GraphicsWindow.FillRectangle(25, 423, 10, 15)
  105. GraphicsWindow.FillTriangle(30, 414, 22.5, 423, 37.5, 423)
  106. GraphicsWindow.FillRectangle(55, 414, 10, 15)
  107. GraphicsWindow.FillTriangle(60, 438, 52.5, 429, 67.5, 429)
  108.  
  109. GraphicsWindow.BrushColor="Blue"
  110. GraphicsWindow.FillRectangle(600, 260, 20, 20)
  111. GraphicsWindow.FillRectangle(630, 260, 20, 20)
  112. GraphicsWindow.BrushColor="Black"
  113. GraphicsWindow.FillRectangle(602.5, 240, 15, 15)
  114. GraphicsWindow.FillRectangle(632.5, 240, 15, 15)
  115. GraphicsWindow.PenColor="White"
  116. GraphicsWindow.DrawLine(632.5, 255, 647.5, 240)
  117.  
  118. GraphicsWindow.BrushColor="Blue"
  119. GraphicsWindow.PenColor="Blue"
  120. GraphicsWindow.FillRectangle(750, 550, 19, 19)
  121. GraphicsWindow.BrushColor="Black"
  122. GraphicsWindow.PenColor="Black"
  123. GraphicsWindow.FillRectangle(750, 530, 9, 9)
  124. GraphicsWindow.FillRectangle(761, 530, 9, 9)
  125. GraphicsWindow.FillRectangle(750, 540, 9, 9)
  126. GraphicsWindow.FillRectangle(761, 540, 9, 9)
  127. GraphicsWindow.BrushColor="White"
  128. GraphicsWindow.PenColor="White"
  129. GraphicsWindow.DrawLine(750, 530, 769, 550)
  130.  
  131. GraphicsWindow.BrushColor="Blue"
  132. GraphicsWindow.PenColor="Blue"
  133. GraphicsWindow.FillRectangle(480, 380, 20, 20)
  134. GraphicsWindow.FillRectangle(510, 380, 20, 20)
  135. GraphicsWindow.BrushColor="Black"
  136. GraphicsWindow.PenColor="Black"
  137. GraphicsWindow.DrawLine(490, 355, 490, 375)
  138. GraphicsWindow.FillTriangle(490, 355, 498, 360, 490, 365)
  139. GraphicsWindow.DrawLine(520, 355, 520, 375)
  140. GraphicsWindow.FillTriangle(520, 355, 512, 360, 520, 365)
  141.  
  142. '+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+='
  143. GraphicsWindow.BrushColor="Blue"
  144. GraphicsWindow.PenColor="Black"
  145. hover = Shapes.AddRectangle(20, 20)
  146. Shapes.Move(hover, 1000, 1000)
  147.  
  148. GraphicsWindow.BrushColor="#a5a5a5"
  149. GraphicsWindow.PenColor="Red"
  150. cursor = Shapes.AddRectangle(10, 10)
  151. Shapes.Move(cursor, CursorX*40+1, CursorY*40+1)
  152. '+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+='
  153. GraphicsWindow.MouseDown = OnMouseDown
  154. GraphicsWindow.KeyDown = OnKeyDown
  155. '+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+='
  156. Sub OnMouseDown
  157. MouseX = GraphicsWindow.MouseX
  158. MouseY = GraphicsWindow.MouseY
  159. If MouseX > 450 And MouseX < 470 And MouseY > 100 And MouseY < 120 Then
  160. If CursorY <> 0 Then
  161. CursorY = CursorY-1
  162. EndIf
  163. Else
  164. If MouseX > 480 And MouseX < 500 And MouseY > 100 And MouseY < 120 Then
  165. If CursorY <> 19 Then
  166. CursorY = CursorY+1
  167. EndIf
  168. Else
  169. If MouseX > 510 And MouseX < 530 And MouseY > 100 And MouseY < 120 Then
  170. If CursorX <> 0 Then
  171. CursorX = CursorX-1
  172. EndIf
  173. Else
  174. If MouseX > 540 And MouseX < 570 And MouseY > 100 And MouseY < 120 Then
  175. If CursorX <> 19 Then
  176. CursorX = CursorX+1
  177. EndIf
  178. Else
  179. If MouseX > 480 And MouseX < 510 And MouseY > 140 And MouseY < 160 Then
  180. GraphicsWindow.BrushColor=Colour
  181. GraphicsWindow.PenColor=Colour
  182. Shapes.Remove(rectangle[CursorX][CursorY])
  183. rectangle[CursorX][CursorY] = Shapes.AddRectangle(10,10)
  184. Shapes.Move(rectangle[CursorX][CursorY], CursorX*10+1, CursorY*10+1)
  185. Else
  186. If MouseX > 510 And MouseX < 530 And MouseY > 140 And MouseY < 160 Then
  187. Shapes.Remove(rectangle[CursorX][CursorY])
  188. ElseIf MouseX > 450 And MouseX < 470 And MouseY > 200 And MouseY < 220 Then
  189. Colour = "#000000"
  190. ElseIf MouseX > 480 And MouseX < 500 And MouseY > 200 And MouseY < 220 Then
  191. Colour = "#282828"
  192. ElseIf MouseX > 510 And MouseX < 530 And MouseY > 200 And MouseY < 220 Then
  193. Colour = "#757575"
  194. ElseIf MouseX > 540 And MouseX < 560 And MouseY > 200 And MouseY < 220 Then
  195. Colour = "#ffffff"
  196. ElseIf MouseX > 450 And MouseX < 470 And MouseY > 230 And MouseY < 250 Then
  197. Colour = "#ff0000"
  198. ElseIf MouseX > 480 And MouseX < 500 And MouseY > 230 And MouseY < 250 Then
  199. Colour = "#ff7700"
  200. ElseIf MouseX > 510 And MouseX < 530 And MouseY > 230 And MouseY < 250 Then
  201. Colour = "#ffff00"
  202. ElseIf MouseX > 540 And MouseX < 560 And MouseY > 230 And MouseY < 250 Then
  203. Colour = "#00ff00"
  204. ElseIf MouseX > 450 And MouseX < 470 And MouseY > 260 And MouseY < 280 Then
  205. Colour = "#c92020"
  206. ElseIf MouseX > 480 And MouseX < 500 And MouseY > 260 And MouseY < 280 Then
  207. Colour = "#db6900"
  208. ElseIf MouseX > 510 And MouseX < 530 And MouseY > 260 And MouseY < 280 Then
  209. Colour = "#dbab00"
  210. ElseIf MouseX > 540 And MouseX < 560 And MouseY > 260 And MouseY < 280 Then
  211. Colour = "#09b72e"
  212. ElseIf MouseX > 450 And MouseX < 470 And MouseY > 290 And MouseY < 310 Then
  213. Colour = "#45e3ef"
  214. ElseIf MouseX > 480 And MouseX < 500 And MouseY > 290 And MouseY < 310 Then
  215. Colour = "#4586ef"
  216. ElseIf MouseX > 510 And MouseX < 530 And MouseY > 290 And MouseY < 310 Then
  217. Colour = "#c034f9"
  218. ElseIf MouseX > 540 And MouseX < 560 And MouseY > 290 And MouseY < 310 Then
  219. Colour = "#ef45d5"
  220. ElseIf MouseX > 450 And MouseX < 470 And MouseY > 320 And MouseY < 340 Then
  221. Colour = "#189999"
  222. ElseIf MouseX > 480 And MouseX < 500 And MouseY > 320 And MouseY < 340 Then
  223. Colour = "#1d29ad"
  224. ElseIf MouseX > 510 And MouseX < 530 And MouseY > 320 And MouseY < 340 Then
  225. Colour = "#aa0f90"
  226. ElseIf MouseX > 540 And MouseX < 560 And MouseY > 320 And MouseY < 340 Then
  227. Colour = "#691291"
  228. ElseIf MouseX > 480 And MouseX < 500 And MouseY > 380 And MouseY < 400 Then
  229. GraphicsWindow.BrushColor="Black"
  230. GraphicsWindow.PenColor="Black"
  231. Shapes.Remove(start)
  232. start = Shapes.AddTriangle(CursorX*10+1, CursorY*10+1, CursorX*10+11, CursorY*10+6, CursorX*10+1, CursorY*10+11)
  233. ElseIf MouseX > 510 And MouseX < 530 And MouseY > 380 And MouseY < 400 Then
  234. GraphicsWindow.BrushColor="Black"
  235. GraphicsWindow.PenColor="Black"
  236. Shapes.Remove(remove)
  237. remove = Shapes.AddTriangle(CursorX*10+11, CursorY*10+1, CursorX*10+1, CursorY*10+6, CursorX*10+11, CursorY*10+11)
  238. ElseIf MouseX > 750 And MouseX < 769 And MouseY > 550 And MouseY < 569 Then
  239. For y = 1 To 40
  240. For z = 1 To 40
  241. Shapes.Remove(rectangle[y-1][z-1])
  242. EndFor
  243. EndFor
  244. ElseIf MouseX > 600 And MouseX < 620 And MouseY > 260 And MouseY < 280 Then
  245. If Colour <> "#000000" And Colour <> "Black" Then
  246. GraphicsWindow.BackgroundColor = Colour
  247. EndIf
  248. ElseIf MouseX > 630 And MouseX < 650 And MouseY > 260 And MouseY < 280 Then
  249. GraphicsWindow.BackgroundColor = "#a5a5a5"
  250. ElseIf MouseX > 20 And MouseX < 40 And MouseY > 440 And MouseY < 460 Then
  251. TextWindow.WriteLine("Copy this code into a .txt file to share and save!")
  252. For x = 1 to 40
  253. For i = 1 to 40
  254. If Shapes.GetTop(rectangle[x-1][i-1]) <> 0 Then
  255. TextWindow.Write("1")
  256. Else
  257. TextWindow.Write("0")
  258. EndIf
  259. EndFor
  260. EndFor
  261. TextWindow.Pause()
  262. TextWindow.Hide()
  263. ElseIf MouseX > 50 And MouseX < 70 And MouseY > 440 And MouseY < 460 Then
  264. TextWindow.Clear()
  265. TextWindow.Show()
  266. TextWindow.WriteLine("Copy the file directory of the txt file with the code:")
  267. TextToReplace = TextWindow.Read()
  268. Code = File.ReadContents(TextToReplace)
  269. TextWindow.Hide()
  270. For y = 1 To 40
  271. For z = 1 To 40 'iterate through each character of string
  272. character[((y-1)*40)+z] = Text.GetSubText(Code, ((y-1)*40)+z, 1)
  273. Shapes.Remove(rectangle[y-1][z-1])
  274. If character[((y-1)*40)+z] = "1" Then
  275. GraphicsWindow.BrushColor="Black"
  276. GraphicsWindow.PenColor="Black"
  277. rectangle[y-1][z-1] = Shapes.AddRectangle(10, 10)
  278. Shapes.Move(rectangle[y-1][z-1], (y-1)*10+1, (z-1)*10+1)
  279. EndIf
  280. EndFor
  281. EndFor
  282. EndIf
  283. EndIf
  284. EndIf
  285. EndIf
  286. EndIf
  287. EndIf
  288. Shapes.Move(cursor, CursorX*10+1, CursorY*10+1)
  289. EndSub
  290.  
  291. Sub OnKeyDown
  292. If GraphicsWindow.LastKey = "A" Or GraphicsWindow.LastKey = "Left" Then
  293. If CursorX <> 0 Then
  294. CursorX = CursorX-1
  295. EndIf
  296. ElseIf GraphicsWindow.LastKey = "S" Or GraphicsWindow.LastKey = "Down" Then
  297. If CursorY <> 39 Then
  298. CursorY = CursorY+1
  299. EndIf
  300. ElseIf GraphicsWindow.LastKey = "D" Or GraphicsWindow.LastKey = "Right" Then
  301. If CursorX <> 39 Then
  302. CursorX = CursorX+1
  303. EndIf
  304. ElseIf GraphicsWindow.LastKey = "W" Or GraphicsWindow.LastKey = "Up" Then
  305. If CursorY <> 0 Then
  306. CursorY = CursorY-1
  307. EndIf
  308. ElseIf GraphicsWindow.LastKey = "Return" Then
  309. GraphicsWindow.BrushColor=Colour
  310. GraphicsWindow.PenColor=Colour
  311. Shapes.Remove(rectangle[CursorX][CursorY])
  312. rectangle[CursorX][CursorY] = Shapes.AddRectangle(10,10)
  313. Shapes.Move(rectangle[CursorX][CursorY], CursorX*10+1, CursorY*10+1)
  314. ElseIf GraphicsWindow.LastKey = "Back" Then
  315. Shapes.Remove(rectangle[CursorX][CursorY])
  316. EndIf
  317. Shapes.Move(cursor, CursorX*10+1, CursorY*10+1)
  318. EndSub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement