Advertisement
JcdShrimp

Untitled

Jun 25th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.67 KB | None | 0 0
  1. Universe2:
  2.  
  3. TextWindow.BackgroundColor = "Blue"
  4. TextWindow.ForegroundColor = "White"
  5. ThickLine()
  6. TextWindow.WriteLine(" _ _ _ _____ ")
  7. TextWindow.WriteLine("| | | | (_) / __ \")
  8. TextWindow.WriteLine("| | | |_ __ ___ _____ _ __ ___ ___\/ / / ")
  9. TextWindow.WriteLine("| | | | /_ \| \ \ / / _ | /__/ __|/ _ \ / / ")
  10. TextWindow.WriteLine("| |_| | | | | |\ V | __| | \__ | __/ /___ ")
  11. TextWindow.WriteLine(" \___/|_| |_|_| \_/ \___|_| |___/\___\_____/")
  12. ThickLine()
  13. TextWindow.WriteLine("A procedurally-generated space exploration ga")
  14. TextWindow.WriteLine("me by Julian Drake. ")
  15. ThickLine()
  16. TextWindow.BackgroundColor = "Black"
  17. TextWindow.ForegroundColor = "White"
  18. TextWindow.WriteLine("What is your name?")
  19. TextWindow.ForegroundColor = "Yellow"
  20. playername = TextWindow.Read()
  21.  
  22.  
  23. Menu:
  24. TextWindow.Clear()
  25. TextWindow.ForegroundColor = "White"
  26. TextWindow.WriteLine("The setup has finished! Welcome to your new operating system, "+playername+"!")
  27. ThickLine()
  28. TextWindow.WriteLine("1 - Ship Constructor")
  29. TextWindow.WriteLine("2 - Planet Generator")
  30. TextWindow.WriteLine("3 - Blaster Generator")
  31. TextWindow.WriteLine("4 - Reset")
  32. TextWindow.WriteLine("5 - Skip to Game")
  33. value = TextWindow.readKey()
  34. If value = "1" Then
  35. TextWindow.Clear()
  36. Goto BuildShip
  37. EndIf
  38. If value = "2" Then
  39. TextWindow.Clear()
  40. Goto BuildPlanet
  41. EndIf
  42. If value = "3" Then
  43. TextWindow.Clear()
  44. Goto BuildGun
  45. EndIf
  46. If value = "4" Then
  47. TextWindow.Clear()
  48. Goto Universe2
  49. EndIf
  50. If value = "5" Then
  51. TextWindow.Clear()
  52. Goto GameMenu2
  53. EndIf
  54.  
  55. TextWindow.Clear()
  56.  
  57. BuildGun:
  58.  
  59. partsFileGun = "C:/users/julian/Documents/Universe2/data/gunPartsASCII.txt
  60. partsFileGunName = "C:/users/julian/Documents/Universe2/data/gunPartsNames.txt
  61.  
  62. attachment = Math.GetRandomNumber(5)
  63. barrel = Math.GetRandomNumber(3)
  64. grip = Math.GetRandomNumber(2)
  65. attachmentcol = Math.GetRandomNumber(15)
  66. barrelcol = Math.GetRandomNumber(15)
  67. gripcol = Math.GetRandomNumber(15)
  68. blastercol = Math.GetRandomNumber(15)
  69.  
  70. TextWindow.BackgroundColor = "White"
  71. TextWindow.ForegroundColor = "Black"
  72. TextWindow.WriteLine("ENTER: Regenerate Blaster | X: Return to Menu")
  73. TextWindow.BackgroundColor = "Black"
  74. TextWindow.ForegroundColor = "White"
  75.  
  76. TextWindow.WriteLine("")
  77. DrawAttachment()
  78. TextWindow.ForegroundColor = barrelcol
  79. TextWindow.Write("[=====")
  80. DrawBarrel()
  81. DrawGrip()
  82.  
  83.  
  84. TextWindow.ForegroundColor = "White"
  85. TextWindow.WriteLine("")
  86. ThickLine()
  87. TextWindow.Write("Attachment: ")
  88. TextWindow.ForegroundColor = attachmentcol
  89. TextWindow.WriteLine(attachmentname)
  90. TextWindow.ForegroundColor = "White"
  91. TextWindow.Write("Barrel: ")
  92. TextWindow.ForegroundColor = barrelcol
  93. TextWindow.WriteLine(barrelname)
  94. TextWindow.ForegroundColor = "White"
  95. TextWindow.Write("Grip: ")
  96. TextWindow.ForegroundColor = gripcol
  97. TextWindow.WriteLine(gripname)
  98. TextWindow.ForegroundColor = "White"
  99.  
  100.  
  101. value = TextWindow.readKey()
  102. If value = "x" Then
  103. TextWindow.Clear()
  104. Goto Menu
  105. EndIf
  106.  
  107.  
  108. Sub DrawAttachment
  109. part = File.ReadLine(partsFileGun,attachment)
  110. attachmentname = File.ReadLine(partsFileGunName,attachment)
  111. TextWindow.ForegroundColor = attachmentcol
  112. TextWindow.WriteLine(part)
  113. EndSub
  114.  
  115. Sub DrawBarrel
  116. part = File.ReadLine(partsFileGun,barrel+5)
  117. barrelname = File.ReadLine(partsFileGunName,barrel+5)
  118. TextWindow.ForegroundColor = barrelcol
  119. TextWindow.WriteLine(part)
  120. EndSub
  121.  
  122. Sub DrawGrip
  123. part = File.ReadLine(partsFileGun,grip+8)
  124. gripname = File.ReadLine(partsFileGunName,grip+8)
  125. TextWindow.ForegroundColor = attachmentcol
  126. TextWindow.WriteLine(part)
  127. EndSub
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. If value = Text.GetCharacter(010) Then
  137. TextWindow.Clear()
  138. Goto BuildGun
  139. EndIf
  140. TextWindow.Clear()
  141. Goto BuildGun
  142.  
  143.  
  144.  
  145.  
  146.  
  147.  
  148.  
  149.  
  150.  
  151.  
  152.  
  153. BuildPlanet:
  154. 'stat vars
  155. atmoscolor = 0
  156. temp = Math.GetRandomNumber(500)
  157. temprange = Math.GetRandomNumber(2)
  158. If temprange = 2 Then
  159. temp = -temp
  160. EndIf
  161.  
  162. atmoslevel = Math.GetRandomNumber(4)
  163. color = Math.GetRandomNumber(15)
  164. If atmoslevel = 1 Then
  165. atmospherestrength = "No atmosphere."
  166. atmoscolor = "DarkGray"
  167. EndIf
  168. If atmoslevel = 2 Then
  169. atmospherestrength = "Weak atmosphere."
  170. atmoscolor = "Blue"
  171. EndIf
  172. If atmoslevel = 3 Then
  173. atmospherestrength = "Decent atmosphere."
  174. atmoscolor = "Green"
  175. EndIf
  176. If atmoslevel = 4 Then
  177. atmospherestrength = "Abundant atmosphere."
  178. atmoscolor = "Red"
  179. EndIf
  180.  
  181. TextWindow.BackgroundColor = "White"
  182. TextWindow.ForegroundColor = "Black"
  183. TextWindow.WriteLine("ENTER: Regenerate Planet | X: Return to Menu")
  184.  
  185.  
  186. TextWindow.BackgroundColor = "Black"
  187. TextWindow.ForegroundColor = color
  188. TextWindow.WriteLine(" ___---___")
  189. TextWindow.WriteLine(" .-- --.")
  190. TextWindow.WriteLine(" ./ () .-. \.")
  191. TextWindow.WriteLine(" / o . ( ) \")
  192. TextWindow.WriteLine(" / . '-' \")
  193. TextWindow.WriteLine(" | () . O . |")
  194. TextWindow.WriteLine(" | |")
  195. TextWindow.WriteLine(" | o () |")
  196. TextWindow.WriteLine(" | .--. O |")
  197. TextWindow.WriteLine(" | . | | |")
  198. TextWindow.WriteLine(" \ `.__.' o . /")
  199. TextWindow.WriteLine(" \ /")
  200. TextWindow.WriteLine(" `\ o () /")
  201. TextWindow.WriteLine(" `--___ ___--'")
  202. TextWindow.WriteLine(" ---")
  203. TextWindow.ForegroundColor = "White"
  204. TextWindow.WriteLine("Planet Temperature: "+temp+"°F.")
  205. TextWindow.Write("Atmospheric Strength: ")
  206. TextWindow.ForegroundColor = atmoscolor
  207. TextWindow.Write(atmospherestrength)
  208. TextWindow.ForegroundColor = "White"
  209.  
  210. value = TextWindow.readKey()
  211. If value = "x" Then
  212. TextWindow.Clear()
  213. Goto Menu
  214. EndIf
  215.  
  216.  
  217.  
  218. If value = Text.GetCharacter(010) Then
  219. TextWindow.Clear()
  220. Goto BuildPlanet
  221. EndIf
  222. TextWindow.Clear()
  223. Goto BuildPlanet
  224.  
  225.  
  226. BuildShip:
  227.  
  228. partsFileCore = "C:/users/julian/Documents/Universe2/data/shipPartsASCIICore.txt
  229. nameFileCore = "C:/users/julian/Documents/Universe2/data/shipPartsNamesCore.txt"
  230. partsFileInner = "C:/users/julian/Documents/Universe2/data/shipPartsASCIIInner.txt
  231. nameFileInner = "C:/users/julian/Documents/Universe2/data/shipPartsNamesInner.txt"
  232. partsFileOuter = "C:/users/julian/Documents/Universe2/data/shipPartsASCIIOuter.txt
  233. nameFileOuter = "C:/users/julian/Documents/Universe2/data/shipPartsNamesOuter.txt"
  234.  
  235.  
  236. 'init name vars
  237. corename = ""
  238. innername = ""
  239. outername = ""
  240. 'init color vars
  241. corecol = ""
  242. innercol = ""
  243. outercol = ""
  244. 'init worth vars
  245. coreworth = 0
  246. innerworth = 0
  247. outerworth = 0
  248.  
  249.  
  250.  
  251.  
  252. GenNewShip:
  253. inner = Math.GetRandomNumber(229)
  254. innercol = Math.GetRandomNumber(15)
  255. core = Math.GetRandomNumber(15)
  256. corecol = Math.GetRandomNumber(15)
  257. outer = Math.GetRandomNumber(15)
  258. outercol = Math.GetRandomNumber(15)
  259. GenShip:
  260. TextWindow.BackgroundColor = "White"
  261. TextWindow.ForegroundColor = "Black"
  262. TextWindow.WriteLine("Welcome aboard, "+playername+".")
  263. TextWindow.WriteLine("S: Save to File | L: Load from File | ENTER: Regenerate Ship | X: Back to Menu | C: Confirm Choice")
  264. TextWindow.BackgroundColor = "Black"
  265.  
  266. TextWindow.WriteLine("")
  267.  
  268. DrawOuter()
  269. DrawInner()
  270. DrawCore()
  271. DrawInner()
  272. DrawOuter()
  273.  
  274.  
  275.  
  276.  
  277. TextWindow.WriteLine("")
  278.  
  279. TextWindow.ForegroundColor = "White"
  280. ThickLine()
  281. TextWindow.Write("Ship Worth: ")
  282. TextWindow.ForegroundColor = "Yellow"
  283. TextWindow.Write(coreworth+innerworth+outerworth)
  284. TextWindow.ForegroundColor = "White"
  285. TextWindow.WriteLine(" Chronodollars")
  286. TextWindow.Write("Ship Firepower: ")
  287. TextWindow.ForegroundColor = "Yellow"
  288. TextWindow.Write(dmg)
  289. TextWindow.ForegroundColor = "White"
  290. TextWindow.WriteLine(" Firepower Potential Units")
  291. TextWindow.Write("Ship Defence: ")
  292. TextWindow.ForegroundColor = "Yellow"
  293. TextWindow.Write(armor)
  294. TextWindow.ForegroundColor = "White"
  295. TextWindow.WriteLine(" Galactic Shield Widths")
  296. TextWindow.Write("Ship Cargo Space: ")
  297. TextWindow.ForegroundColor = "Yellow"
  298. TextWindow.Write(storage)
  299. TextWindow.ForegroundColor = "White"
  300. TextWindow.WriteLine(" Material Storage Quantities")
  301. ThickLine()
  302. TextWindow.WriteLine("Ship Core: ")
  303. TextWindow.ForegroundColor = corecol
  304. TextWindow.WriteLine(corename)
  305. TextWindow.ForegroundColor = "White"
  306. ThinLine()
  307. TextWindow.WriteLine("Ship Inner Component: ")
  308. TextWindow.ForegroundColor = innercol
  309. TextWindow.WriteLine(innername)
  310. TextWindow.ForegroundColor = "White"
  311. ThinLine()
  312. TextWindow.WriteLine("Ship Outer Component: ")
  313. TextWindow.ForegroundColor = outercol
  314. TextWindow.WriteLine(outername)
  315. TextWindow.ForegroundColor = "White"
  316. ThinLine()
  317. TextWindow.Write("")
  318.  
  319. value = TextWindow.readKey()
  320. If value = "s" Then
  321. SaveShip()
  322. Goto GenShip
  323. EndIf
  324. If value = "l" Then
  325. LoadShip()
  326. Goto GenShip
  327. EndIf
  328. If value = "x" Then
  329. TextWindow.Clear()
  330. Goto Menu
  331. EndIf
  332. If value = "c" Then
  333. Goto BuyShip
  334. EndIf
  335. TextWindow.Clear()
  336. Goto GenNewShip
  337.  
  338. BuyShip:
  339. If coreworth+innerworth+outerworth < 5001 Then
  340. 'setup game vars
  341. PLAYERSHIPcore = core
  342. PLAYERSHIPinner = inner
  343. PLAYERSHIPouter = outer
  344. PLAYERSHIPcorecol = corecol
  345. PLAYERSHIPinnercol = innercol
  346. PLAYERSHIPoutercol = outercol
  347. PLAYERSHIPdmg = dmg
  348. PLAYERSHIParmor = armor
  349. PLAYERSHIPstorage = storage
  350. PLAYERSHIPx = 0
  351. PLAYERSHIPy = 0
  352. TextWindow.ForegroundColor = "Green"
  353. TextWindow.WriteLine("Purchase successful!")
  354. TextWindow.ForegroundColor = "White"
  355. Goto GameMenu2
  356. Else
  357. TextWindow.ForegroundColor = "Red"
  358. TextWindow.WriteLine("This craft is too expensive, generate a new one!")
  359. TextWindow.ForegroundColor = "White"
  360. TextWindow.PauseWithoutMessage()
  361. TextWindow.Clear()
  362. Goto GenNewShip
  363. EndIf
  364.  
  365.  
  366.  
  367.  
  368. Sub DrawCore
  369. part = File.ReadLine(partsFileCore,core)
  370. TextWindow.ForegroundColor = corecol
  371. TextWindow.WriteLine(part)
  372. corename = File.ReadLine(nameFileCore,core)
  373. storage = Math.GetRandomNumber(200)+50
  374. EndSub
  375.  
  376. Sub DrawInner
  377. part = File.ReadLine(partsFileInner,inner)
  378. TextWindow.ForegroundColor = innercol
  379. TextWindow.WriteLine(part)
  380. innername = File.ReadLine(nameFileInner,inner)
  381. If inner < 150 Then
  382. innerworth = Math.GetRandomNumber(5000)+500
  383. Else
  384. innerworth = Math.GetRandomNumber(10000)+1000
  385. EndIf
  386. dmg = Math.GetRandomNumber(1000)+500
  387. EndSub
  388.  
  389. Sub DrawOuter
  390. part = File.ReadLine(partsFileOuter,outer)
  391. TextWindow.ForegroundColor = outercol
  392. TextWindow.WriteLine(part)
  393. outername = File.ReadLine(nameFileOuter,outer)
  394. If outer < 150 Then
  395. outerworth = Math.GetRandomNumber(5000)+500
  396. Else
  397. outerworth = Math.GetRandomNumber(10000)+1000
  398. EndIf
  399. armor = Math.GetRandomNumber(1000)+500
  400. EndSub
  401.  
  402.  
  403. Sub SaveShip
  404. TextWindow.Clear()
  405. TextWindow.WriteLine("File to save your ship as:")
  406. savefile = "C:/users/julian/Documents/Universe2/ships/"+TextWindow.Read()
  407. File.WriteLine(savefile,1,core)
  408. File.WriteLine(savefile,2,inner)
  409. File.WriteLine(savefile,3,outer)
  410. TextWindow.WriteLine("Spaceship saved successfully!")
  411. TextWindow.PauseWithoutMessage()
  412. TextWindow.Clear()
  413. EndSub
  414. Sub LoadShip
  415. TextWindow.Clear()
  416. TextWindow.WriteLine("File to load your ship from:")
  417. loadfile = "C:/users/julian/Documents/Universe2/ships/"+TextWindow.Read()
  418. core = File.ReadLine(savefile,1)
  419. inner = File.ReadLine(savefile,2)
  420. outer = File.ReadLine(savefile,3)
  421. TextWindow.WriteLine("Spaceship loaded successfully!")
  422. TextWindow.PauseWithoutMessage()
  423. TextWindow.Clear()
  424. EndSub
  425.  
  426. Sub ThickLine
  427. TextWindow.WriteLine("=============================================")
  428. EndSub
  429. Sub ThinLine
  430. TextWindow.WriteLine("---------------------------------------------")
  431. EndSub
  432.  
  433. Sub PopulateSpace
  434. x = 0
  435. While x < 1000
  436. SPACExdata[x] = Math.GetRandomNumber(15)
  437. x = x + 1
  438. EndWhile
  439. EndSub
  440.  
  441.  
  442.  
  443.  
  444.  
  445.  
  446.  
  447. GameMenu2:
  448. showDetails = 0
  449. TextWindow.WriteLine("Populating universe, be patient!")
  450. PopulateSpace()
  451. GameMenu:
  452. TextWindow.Clear()
  453. TextWindow.ForegroundColor = "Black"
  454. TextWindow.BackgroundColor = "White"
  455. TextWindow.WriteLine("Universe2 Alpha 0.1")
  456. TextWindow.BackgroundColor = "Black"
  457. TextWindow.ForegroundColor = "White"
  458. ThickLine()
  459. TextWindow.WriteLine("1 - Move Ship")
  460. value = TextWindow.readKey()
  461. If value = "1" Then
  462. TextWindow.Clear()
  463. Goto MoveShip
  464.  
  465. EndIf
  466.  
  467. MoveShip:
  468.  
  469. TextWindow.BackgroundColor = "White"
  470. TextWindow.ForegroundColor = "Black"
  471. TextWindow.WriteLine("AD - Move | X - Return to Menu | C - Toggle Details")
  472.  
  473.  
  474. TextWindow.ForegroundColor = "White"
  475. TextWindow.BackgroundColor = "Black"
  476.  
  477. TextWindow.WriteLine("")
  478. TextWindow.Write("Ship X: ")
  479. TextWindow.WriteLine(PLAYERSHIPx)
  480.  
  481. OccurancesFile = "C:/users/julian/Documents/Universe2/data/randomOccurances.txt"
  482. DetailsFile = "C:/users/julian/Documents/Universe2/data/OccuranceDetails.txt"
  483.  
  484. occurance = File.ReadLine(OccurancesFile,SPACExdata[PLAYERSHIPx])
  485. TextWindow.ForegroundColor = SPACExdata[PLAYERSHIPx]
  486. TextWindow.WriteLine(occurance)
  487. TextWindow.ForegroundColor = "White"
  488. If showDetails = 1 Then
  489. ThickLine()
  490. details = File.ReadLine(DetailsFile,SPACExdata[PLAYERSHIPx])
  491. TextWindow.WriteLine(details)
  492. EndIf
  493. value = TextWindow.readKey()
  494. If value = "d" Then
  495. If PLAYERSHIPx < 1000 Then
  496. PLAYERSHIPx = PLAYERSHIPx + 1
  497. EndIf
  498. TextWindow.Clear()
  499. Goto MoveShip
  500. EndIf
  501. If value = "a" Then
  502. If PLAYERSHIPx > 0 Then
  503. PLAYERSHIPx = PLAYERSHIPx - 1
  504. EndIf
  505. TextWindow.Clear()
  506. Goto MoveShip
  507. EndIf
  508. If value = "x" Then
  509. TextWindow.Clear()
  510. Goto GameMenu
  511. EndIf
  512. If value = "c" Then
  513. If showDetails = 1 Then
  514. showDetails = 0
  515. EndIf
  516. If showDetails = 0 Then
  517. showDetails = 1
  518. EndIf
  519. Goto MoveShip
  520. EndIf
  521.  
  522.  
  523. TextWindow.Clear()
  524. Goto MoveShip
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement