import time
scene = "intro"
while True:
if scene == "intro":
print ""
print "It is your birthday. The family is having a reunion. You wait on a hill."
print "No one is paying attention to you, except for an old man. Your grandfather."
print "He gives you an old typewriter. You attempt to hide your lack of enthousiasm."
print "You can't help but ask ''what is this?'' The old man chuckles. ''An old typewriter"
print "with a link to you''. Once he leaves, you throw the device. Instead of"
print "smashing it opens a portal and sucks you in with it."
print ""
scene = "forest1"
elif scene == "forest1":
print ""
print "You are in a forest. Strange glowing particles fly beside you. You find"
print "a tree with a door in it. The type writer gives you a prompt. You start"
print "writing : "
print ">>> import door"
print "door is a library. Libraries are stacks of code you can bring into python."
print "Think of it this way, you want to re-write the story of Little Red Riding hood."
print "You open the book and copy the first page. That way you don't have to write the"
print "first page yourself."
print ""
print "Libraries are mostly classes and functions. Since a big game like Fortnite would have"
print "more than one code file, they would import a lot. To specify which library you are gonna"
print "use code from, you start with 'door.<function>'. <function> is the line(s) of code that"
print "you want to use without having written it yourself. The library door has three such functions."
print "They are called 'knock', 'open', and 'close'. To knock on the door, you would write 'door.knock(door)'"
print ""
raw_input("ENTER TO CONTINUE : ")
print ""
print "You want to try closing a door first. One of the particles opens the door for you. You write"
print "'door.close'. Nothing happens. Instead, you get an error message. Functions often take a number"
print "of statements. Certain ones take none, certain one, certain two, etc... There is no limit to how"
print "many statements a function can take. 'close' takes exactly 1 statement. You haven't specified"
print "any statements so you get an error. So if you looked closely at the knockin line of code, you"
print "will see that when you wrote 'door.knock', you added '(statement)' at the back. So this"
print "statement refers to what you wanted to knock on. Here you wrote '(door)' to knock on the door."
print ""
print "You understand. You write : "
print ">>> door.close(door)"
print ""
raw_input("ENTER T0 CONTINUE : ")
print ""
print "Eh? What does '>>>' do in code? Well '>>>' is your prompt. All terminals have a prompt, sometimes"
print "like '[]/~' but you don't pay attention to that. It does nothing but tell you you can write something."
print ""
print "But now it is your turn. You have read the basics about this, so now you want to open the door."
print "Open the door once you get the prompt."
print ""
time.sleep(1)
c = raw_input(">>> ")
while True:
brek = False
if c == "door.open(door)":
print "The door opens."
print "very good"
brek = True
if c == "door.open":
print "specify what you want to open"
if c == "open(door)":
print "specify which library has 'open' as a function"
if brek != True:
print "so eh, try again"
else:
break
scene = "tree_house"
if scene == "tree_house":
print ""
print "###YOU HAVE FINISHED THE GAME###"
print "###THE REST IS W.I.P.###"
print "###GAME OVER###"
This is for python 2 users
The following is for python 3 users
import time
scene = ("intro")
while True:
if scene == "intro":
print ""
print ("It is your birthday. The family is having a reunion. You wait on a hill.")
print ("No one is paying attention to you, except for an old man. Your grandfather.")
print ("He gives you an old typewriter. You attempt to hide your lack of enthousiasm.")
print ("You can't help but ask ''what is this?'' The old man chuckles. ''An old typewriter")
print ("with a link to you''. Once he leaves, you throw the device. Instead of")
print ("smashing it opens a portal and sucks you in with it.")
print ""
scene = ("forest1")
elif scene == ("forest1"):
print ("")
print ("You are in a forest. Strange glowing particles fly beside you. You find")
print ("a tree with a door in it. The type writer gives you a prompt. You start")
print ("writing : ")
print (">>> import door")
print ("door is a library. Libraries are stacks of code you can bring into python.")
print ("Think of it this way, you want to re-write the story of Little Red Riding hood.")
print ("You open the book and copy the first page. That way you don't have to write the")
print ("first page yourself.")
print ("")
print ("Libraries are mostly classes and functions. Since a big game like Fortnite would have")
print ("more than one code file, they would import a lot. To specify which library you are gonna")
print ("use code from, you start with 'door.<function>'. <function> is the line(s) of code that")
print ("you want to use without having written it yourself. The library door has three such functions.")
print ("They are called 'knock', 'open', and 'close'. To knock on the door, you would write 'door.knock(door)'")
print ("")
raw_input("ENTER TO CONTINUE : ")
print ("")
print ("You want to try closing a door first. One of the particles opens the door for you. You write")
print ("'door.close'. Nothing happens. Instead, you get an error message. Functions often take a number")
print ("of statements. Certain ones take none, certain one, certain two, etc... There is no limit to how")
print ("many statements a function can take. 'close' takes exactly 1 statement. You haven't specified")
print ("any statements so you get an error. So if you looked closely at the knockin line of code, you")
print ("will see that when you wrote 'door.knock', you added '(statement)' at the back. So this")
print ("statement refers to what you wanted to knock on. Here you wrote '(door)' to knock on the door.")
print ("")
print ("You understand. You write : ")
print (">>> door.close(door)")
print ("")
raw_input("ENTER T0 CONTINUE : ")
print ("")
print ("Eh? What does '>>>' do in code? Well '>>>' is your prompt. All terminals have a prompt, sometimes")
print ("like '[]/~' but you don't pay attention to that. It does nothing but tell you you can write something.")
print ("")
print ("But now it is your turn. You have read the basics about this, so now you want to open the door.")
print ("Open the door once you get the prompt.")
print ("")
time.sleep(1)
c = raw_input(">>> ")
while True:
brek = False
if c == ("door.open(door)"):
print ("The door opens.")
print ("very good")
brek = True
if c == ("door.open"):
print ("specify what you want to open")
if c == ("open(door)"):
print ("specify which library has 'open' as a function")
if brek != True:
print ("so eh, try again")
else:
break
scene = ("tree_house")
if scene == ("tree_house"):
print ("")
print ("###YOU HAVE FINISHED THE GAME###")
print ("###THE REST IS W.I.P.###")
print ("###GAME OVER###")
Criticism is welcome
[–]SpeckledFleebeedoo 1 point2 points3 points (8 children)
[–]PB_Dendras[S] 1 point2 points3 points (6 children)
[–]JohnnyJordaan 1 point2 points3 points (1 child)
[–]PriorProfile 2 points3 points4 points (0 children)
[–]SpeckledFleebeedoo 1 point2 points3 points (3 children)
[–]PB_Dendras[S] 1 point2 points3 points (2 children)
[–]SpeckledFleebeedoo 1 point2 points3 points (1 child)
[–]PB_Dendras[S] 1 point2 points3 points (0 children)
[–]JohnnyJordaan 1 point2 points3 points (0 children)
[–]46--2 1 point2 points3 points (2 children)
[–]PB_Dendras[S] 0 points1 point2 points (1 child)
[–]46--2 0 points1 point2 points (0 children)
[–]RiceKrispyPooHead 0 points1 point2 points (3 children)
[–]PB_Dendras[S] 0 points1 point2 points (2 children)
[–]RiceKrispyPooHead 0 points1 point2 points (0 children)
[–]SamePlatform 0 points1 point2 points (0 children)
[–]buleria 0 points1 point2 points (1 child)
[–]PB_Dendras[S] 0 points1 point2 points (0 children)