Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Universe2:
- TextWindow.BackgroundColor = "Blue"
- TextWindow.ForegroundColor = "White"
- ThickLine()
- TextWindow.WriteLine(" _ _ _ _____ ")
- TextWindow.WriteLine("| | | | (_) / __ \")
- TextWindow.WriteLine("| | | |_ __ ___ _____ _ __ ___ ___\/ / / ")
- TextWindow.WriteLine("| | | | /_ \| \ \ / / _ | /__/ __|/ _ \ / / ")
- TextWindow.WriteLine("| |_| | | | | |\ V | __| | \__ | __/ /___ ")
- TextWindow.WriteLine(" \___/|_| |_|_| \_/ \___|_| |___/\___\_____/")
- ThickLine()
- TextWindow.WriteLine("A procedurally-generated space exploration ga")
- TextWindow.WriteLine("me by Julian Drake. ")
- ThickLine()
- TextWindow.BackgroundColor = "Black"
- TextWindow.ForegroundColor = "White"
- TextWindow.WriteLine("What is your name?")
- TextWindow.ForegroundColor = "Yellow"
- playername = TextWindow.Read()
- Menu:
- TextWindow.Clear()
- TextWindow.ForegroundColor = "White"
- TextWindow.WriteLine("The setup has finished! Welcome to your new operating system, "+playername+"!")
- ThickLine()
- TextWindow.WriteLine("1 - Ship Constructor")
- TextWindow.WriteLine("2 - Planet Generator")
- TextWindow.WriteLine("3 - Blaster Generator")
- TextWindow.WriteLine("4 - Reset")
- TextWindow.WriteLine("5 - Skip to Game")
- value = TextWindow.readKey()
- If value = "1" Then
- TextWindow.Clear()
- Goto BuildShip
- EndIf
- If value = "2" Then
- TextWindow.Clear()
- Goto BuildPlanet
- EndIf
- If value = "3" Then
- TextWindow.Clear()
- Goto BuildGun
- EndIf
- If value = "4" Then
- TextWindow.Clear()
- Goto Universe2
- EndIf
- If value = "5" Then
- TextWindow.Clear()
- Goto GameMenu2
- EndIf
- TextWindow.Clear()
- BuildGun:
- partsFileGun = "C:/users/julian/Documents/Universe2/data/gunPartsASCII.txt
- partsFileGunName = "C:/users/julian/Documents/Universe2/data/gunPartsNames.txt
- attachment = Math.GetRandomNumber(5)
- barrel = Math.GetRandomNumber(3)
- grip = Math.GetRandomNumber(2)
- attachmentcol = Math.GetRandomNumber(15)
- barrelcol = Math.GetRandomNumber(15)
- gripcol = Math.GetRandomNumber(15)
- blastercol = Math.GetRandomNumber(15)
- TextWindow.BackgroundColor = "White"
- TextWindow.ForegroundColor = "Black"
- TextWindow.WriteLine("ENTER: Regenerate Blaster | X: Return to Menu")
- TextWindow.BackgroundColor = "Black"
- TextWindow.ForegroundColor = "White"
- TextWindow.WriteLine("")
- DrawAttachment()
- TextWindow.ForegroundColor = barrelcol
- TextWindow.Write("[=====")
- DrawBarrel()
- DrawGrip()
- TextWindow.ForegroundColor = "White"
- TextWindow.WriteLine("")
- ThickLine()
- TextWindow.Write("Attachment: ")
- TextWindow.ForegroundColor = attachmentcol
- TextWindow.WriteLine(attachmentname)
- TextWindow.ForegroundColor = "White"
- TextWindow.Write("Barrel: ")
- TextWindow.ForegroundColor = barrelcol
- TextWindow.WriteLine(barrelname)
- TextWindow.ForegroundColor = "White"
- TextWindow.Write("Grip: ")
- TextWindow.ForegroundColor = gripcol
- TextWindow.WriteLine(gripname)
- TextWindow.ForegroundColor = "White"
- value = TextWindow.readKey()
- If value = "x" Then
- TextWindow.Clear()
- Goto Menu
- EndIf
- Sub DrawAttachment
- part = File.ReadLine(partsFileGun,attachment)
- attachmentname = File.ReadLine(partsFileGunName,attachment)
- TextWindow.ForegroundColor = attachmentcol
- TextWindow.WriteLine(part)
- EndSub
- Sub DrawBarrel
- part = File.ReadLine(partsFileGun,barrel+5)
- barrelname = File.ReadLine(partsFileGunName,barrel+5)
- TextWindow.ForegroundColor = barrelcol
- TextWindow.WriteLine(part)
- EndSub
- Sub DrawGrip
- part = File.ReadLine(partsFileGun,grip+8)
- gripname = File.ReadLine(partsFileGunName,grip+8)
- TextWindow.ForegroundColor = attachmentcol
- TextWindow.WriteLine(part)
- EndSub
- If value = Text.GetCharacter(010) Then
- TextWindow.Clear()
- Goto BuildGun
- EndIf
- TextWindow.Clear()
- Goto BuildGun
- BuildPlanet:
- 'stat vars
- atmoscolor = 0
- temp = Math.GetRandomNumber(500)
- temprange = Math.GetRandomNumber(2)
- If temprange = 2 Then
- temp = -temp
- EndIf
- atmoslevel = Math.GetRandomNumber(4)
- color = Math.GetRandomNumber(15)
- If atmoslevel = 1 Then
- atmospherestrength = "No atmosphere."
- atmoscolor = "DarkGray"
- EndIf
- If atmoslevel = 2 Then
- atmospherestrength = "Weak atmosphere."
- atmoscolor = "Blue"
- EndIf
- If atmoslevel = 3 Then
- atmospherestrength = "Decent atmosphere."
- atmoscolor = "Green"
- EndIf
- If atmoslevel = 4 Then
- atmospherestrength = "Abundant atmosphere."
- atmoscolor = "Red"
- EndIf
- TextWindow.BackgroundColor = "White"
- TextWindow.ForegroundColor = "Black"
- TextWindow.WriteLine("ENTER: Regenerate Planet | X: Return to Menu")
- TextWindow.BackgroundColor = "Black"
- TextWindow.ForegroundColor = color
- TextWindow.WriteLine(" ___---___")
- TextWindow.WriteLine(" .-- --.")
- TextWindow.WriteLine(" ./ () .-. \.")
- TextWindow.WriteLine(" / o . ( ) \")
- TextWindow.WriteLine(" / . '-' \")
- TextWindow.WriteLine(" | () . O . |")
- TextWindow.WriteLine(" | |")
- TextWindow.WriteLine(" | o () |")
- TextWindow.WriteLine(" | .--. O |")
- TextWindow.WriteLine(" | . | | |")
- TextWindow.WriteLine(" \ `.__.' o . /")
- TextWindow.WriteLine(" \ /")
- TextWindow.WriteLine(" `\ o () /")
- TextWindow.WriteLine(" `--___ ___--'")
- TextWindow.WriteLine(" ---")
- TextWindow.ForegroundColor = "White"
- TextWindow.WriteLine("Planet Temperature: "+temp+"°F.")
- TextWindow.Write("Atmospheric Strength: ")
- TextWindow.ForegroundColor = atmoscolor
- TextWindow.Write(atmospherestrength)
- TextWindow.ForegroundColor = "White"
- value = TextWindow.readKey()
- If value = "x" Then
- TextWindow.Clear()
- Goto Menu
- EndIf
- If value = Text.GetCharacter(010) Then
- TextWindow.Clear()
- Goto BuildPlanet
- EndIf
- TextWindow.Clear()
- Goto BuildPlanet
- BuildShip:
- partsFileCore = "C:/users/julian/Documents/Universe2/data/shipPartsASCIICore.txt
- nameFileCore = "C:/users/julian/Documents/Universe2/data/shipPartsNamesCore.txt"
- partsFileInner = "C:/users/julian/Documents/Universe2/data/shipPartsASCIIInner.txt
- nameFileInner = "C:/users/julian/Documents/Universe2/data/shipPartsNamesInner.txt"
- partsFileOuter = "C:/users/julian/Documents/Universe2/data/shipPartsASCIIOuter.txt
- nameFileOuter = "C:/users/julian/Documents/Universe2/data/shipPartsNamesOuter.txt"
- 'init name vars
- corename = ""
- innername = ""
- outername = ""
- 'init color vars
- corecol = ""
- innercol = ""
- outercol = ""
- 'init worth vars
- coreworth = 0
- innerworth = 0
- outerworth = 0
- GenNewShip:
- inner = Math.GetRandomNumber(229)
- innercol = Math.GetRandomNumber(15)
- core = Math.GetRandomNumber(15)
- corecol = Math.GetRandomNumber(15)
- outer = Math.GetRandomNumber(15)
- outercol = Math.GetRandomNumber(15)
- GenShip:
- TextWindow.BackgroundColor = "White"
- TextWindow.ForegroundColor = "Black"
- TextWindow.WriteLine("Welcome aboard, "+playername+".")
- TextWindow.WriteLine("S: Save to File | L: Load from File | ENTER: Regenerate Ship | X: Back to Menu | C: Confirm Choice")
- TextWindow.BackgroundColor = "Black"
- TextWindow.WriteLine("")
- DrawOuter()
- DrawInner()
- DrawCore()
- DrawInner()
- DrawOuter()
- TextWindow.WriteLine("")
- TextWindow.ForegroundColor = "White"
- ThickLine()
- TextWindow.Write("Ship Worth: ")
- TextWindow.ForegroundColor = "Yellow"
- TextWindow.Write(coreworth+innerworth+outerworth)
- TextWindow.ForegroundColor = "White"
- TextWindow.WriteLine(" Chronodollars")
- TextWindow.Write("Ship Firepower: ")
- TextWindow.ForegroundColor = "Yellow"
- TextWindow.Write(dmg)
- TextWindow.ForegroundColor = "White"
- TextWindow.WriteLine(" Firepower Potential Units")
- TextWindow.Write("Ship Defence: ")
- TextWindow.ForegroundColor = "Yellow"
- TextWindow.Write(armor)
- TextWindow.ForegroundColor = "White"
- TextWindow.WriteLine(" Galactic Shield Widths")
- TextWindow.Write("Ship Cargo Space: ")
- TextWindow.ForegroundColor = "Yellow"
- TextWindow.Write(storage)
- TextWindow.ForegroundColor = "White"
- TextWindow.WriteLine(" Material Storage Quantities")
- ThickLine()
- TextWindow.WriteLine("Ship Core: ")
- TextWindow.ForegroundColor = corecol
- TextWindow.WriteLine(corename)
- TextWindow.ForegroundColor = "White"
- ThinLine()
- TextWindow.WriteLine("Ship Inner Component: ")
- TextWindow.ForegroundColor = innercol
- TextWindow.WriteLine(innername)
- TextWindow.ForegroundColor = "White"
- ThinLine()
- TextWindow.WriteLine("Ship Outer Component: ")
- TextWindow.ForegroundColor = outercol
- TextWindow.WriteLine(outername)
- TextWindow.ForegroundColor = "White"
- ThinLine()
- TextWindow.Write("")
- value = TextWindow.readKey()
- If value = "s" Then
- SaveShip()
- Goto GenShip
- EndIf
- If value = "l" Then
- LoadShip()
- Goto GenShip
- EndIf
- If value = "x" Then
- TextWindow.Clear()
- Goto Menu
- EndIf
- If value = "c" Then
- Goto BuyShip
- EndIf
- TextWindow.Clear()
- Goto GenNewShip
- BuyShip:
- If coreworth+innerworth+outerworth < 5001 Then
- 'setup game vars
- PLAYERSHIPcore = core
- PLAYERSHIPinner = inner
- PLAYERSHIPouter = outer
- PLAYERSHIPcorecol = corecol
- PLAYERSHIPinnercol = innercol
- PLAYERSHIPoutercol = outercol
- PLAYERSHIPdmg = dmg
- PLAYERSHIParmor = armor
- PLAYERSHIPstorage = storage
- PLAYERSHIPx = 0
- PLAYERSHIPy = 0
- TextWindow.ForegroundColor = "Green"
- TextWindow.WriteLine("Purchase successful!")
- TextWindow.ForegroundColor = "White"
- Goto GameMenu2
- Else
- TextWindow.ForegroundColor = "Red"
- TextWindow.WriteLine("This craft is too expensive, generate a new one!")
- TextWindow.ForegroundColor = "White"
- TextWindow.PauseWithoutMessage()
- TextWindow.Clear()
- Goto GenNewShip
- EndIf
- Sub DrawCore
- part = File.ReadLine(partsFileCore,core)
- TextWindow.ForegroundColor = corecol
- TextWindow.WriteLine(part)
- corename = File.ReadLine(nameFileCore,core)
- storage = Math.GetRandomNumber(200)+50
- EndSub
- Sub DrawInner
- part = File.ReadLine(partsFileInner,inner)
- TextWindow.ForegroundColor = innercol
- TextWindow.WriteLine(part)
- innername = File.ReadLine(nameFileInner,inner)
- If inner < 150 Then
- innerworth = Math.GetRandomNumber(5000)+500
- Else
- innerworth = Math.GetRandomNumber(10000)+1000
- EndIf
- dmg = Math.GetRandomNumber(1000)+500
- EndSub
- Sub DrawOuter
- part = File.ReadLine(partsFileOuter,outer)
- TextWindow.ForegroundColor = outercol
- TextWindow.WriteLine(part)
- outername = File.ReadLine(nameFileOuter,outer)
- If outer < 150 Then
- outerworth = Math.GetRandomNumber(5000)+500
- Else
- outerworth = Math.GetRandomNumber(10000)+1000
- EndIf
- armor = Math.GetRandomNumber(1000)+500
- EndSub
- Sub SaveShip
- TextWindow.Clear()
- TextWindow.WriteLine("File to save your ship as:")
- savefile = "C:/users/julian/Documents/Universe2/ships/"+TextWindow.Read()
- File.WriteLine(savefile,1,core)
- File.WriteLine(savefile,2,inner)
- File.WriteLine(savefile,3,outer)
- TextWindow.WriteLine("Spaceship saved successfully!")
- TextWindow.PauseWithoutMessage()
- TextWindow.Clear()
- EndSub
- Sub LoadShip
- TextWindow.Clear()
- TextWindow.WriteLine("File to load your ship from:")
- loadfile = "C:/users/julian/Documents/Universe2/ships/"+TextWindow.Read()
- core = File.ReadLine(savefile,1)
- inner = File.ReadLine(savefile,2)
- outer = File.ReadLine(savefile,3)
- TextWindow.WriteLine("Spaceship loaded successfully!")
- TextWindow.PauseWithoutMessage()
- TextWindow.Clear()
- EndSub
- Sub ThickLine
- TextWindow.WriteLine("=============================================")
- EndSub
- Sub ThinLine
- TextWindow.WriteLine("---------------------------------------------")
- EndSub
- Sub PopulateSpace
- x = 0
- While x < 1000
- SPACExdata[x] = Math.GetRandomNumber(15)
- x = x + 1
- EndWhile
- EndSub
- GameMenu2:
- showDetails = 0
- TextWindow.WriteLine("Populating universe, be patient!")
- PopulateSpace()
- GameMenu:
- TextWindow.Clear()
- TextWindow.ForegroundColor = "Black"
- TextWindow.BackgroundColor = "White"
- TextWindow.WriteLine("Universe2 Alpha 0.1")
- TextWindow.BackgroundColor = "Black"
- TextWindow.ForegroundColor = "White"
- ThickLine()
- TextWindow.WriteLine("1 - Move Ship")
- value = TextWindow.readKey()
- If value = "1" Then
- TextWindow.Clear()
- Goto MoveShip
- EndIf
- MoveShip:
- TextWindow.BackgroundColor = "White"
- TextWindow.ForegroundColor = "Black"
- TextWindow.WriteLine("AD - Move | X - Return to Menu | C - Toggle Details")
- TextWindow.ForegroundColor = "White"
- TextWindow.BackgroundColor = "Black"
- TextWindow.WriteLine("")
- TextWindow.Write("Ship X: ")
- TextWindow.WriteLine(PLAYERSHIPx)
- OccurancesFile = "C:/users/julian/Documents/Universe2/data/randomOccurances.txt"
- DetailsFile = "C:/users/julian/Documents/Universe2/data/OccuranceDetails.txt"
- occurance = File.ReadLine(OccurancesFile,SPACExdata[PLAYERSHIPx])
- TextWindow.ForegroundColor = SPACExdata[PLAYERSHIPx]
- TextWindow.WriteLine(occurance)
- TextWindow.ForegroundColor = "White"
- If showDetails = 1 Then
- ThickLine()
- details = File.ReadLine(DetailsFile,SPACExdata[PLAYERSHIPx])
- TextWindow.WriteLine(details)
- EndIf
- value = TextWindow.readKey()
- If value = "d" Then
- If PLAYERSHIPx < 1000 Then
- PLAYERSHIPx = PLAYERSHIPx + 1
- EndIf
- TextWindow.Clear()
- Goto MoveShip
- EndIf
- If value = "a" Then
- If PLAYERSHIPx > 0 Then
- PLAYERSHIPx = PLAYERSHIPx - 1
- EndIf
- TextWindow.Clear()
- Goto MoveShip
- EndIf
- If value = "x" Then
- TextWindow.Clear()
- Goto GameMenu
- EndIf
- If value = "c" Then
- If showDetails = 1 Then
- showDetails = 0
- EndIf
- If showDetails = 0 Then
- showDetails = 1
- EndIf
- Goto MoveShip
- EndIf
- TextWindow.Clear()
- Goto MoveShip
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement