spacetrack/lib/player.jl
2018-11-20 17:23:43 -07:00

64 lines
1.2 KiB
Julia
Executable File

#!/usr/bin/julia
include("saveGame.jl")
mutable struct Pilot
Name::String
Planet::String
Pilot() = new()
end
mutable struct Ship
Name::String
Class::String
Speed::Float64
Ship() = new()
end
function create_pilot()
print("\nWhat name for new pilot?: ")
pname = readline()
print("What name for ship?: ")
sname = readline()
pilot = Pilot()
ship = Ship()
playerId = "100"
pilot.Name = pname
ship.Name = sname
print("\nYour Pilot's Name is: ", pilot.Name, "\n")
print("Your Ship's name is: ", ship.Name, "\n\n")
print("Is this correct? [Y/n]: ")
pconfirm = readline()
if pconfirm == "y"
if isdir(saveDir) == true && isfile(saveFile) == true
print("Do you want to overwrite previous game?[y/N]: " )
overwrite = readline()
if overwrite == "y"
savegame(playerId, pilot.Name, ship.Name, true)
println("Game saved to: ", saveFile)
else
exit(0)
end
else
savegame(playerId, pilot.Name, ship.Name, true)
println("Game saved to: ", saveFile)
end
else
println("Exiting")
exit(0)
end
end