Created
December 3, 2017 02:28
-
-
Save tashachin/8ac540bd535674d748573b7f4b925827 to your computer and use it in GitHub Desktop.
First terminal-based Python game for Hackbright prep course. WIP.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Can come back later to set tally to 0 for a "hard mode" option. | |
def tally_update(value, tally = 3): | |
"""Retrieves the point value of the player's dialogue option.""" | |
tally = tally + value | |
if tally < 0: | |
tally = 0 | |
return tally | |
def get_player_dialogue(): | |
"""Determines which dialogue option to use.""" | |
player_choice = raw_input("(Please select a number.) > ") | |
return player_choice | |
def ending_picker(): | |
"""Checks value of relationship score tally. Prints appropriate ending.""" | |
if tally <= 3: | |
ending_one() | |
elif tally >= 4 and tally <= 8: | |
ending_two() | |
else: | |
ending_three() | |
######### END OF COMPUTATIONAL FUNCTIONS ######### | |
######### START OF DIALOGUE FUNCTIONS ######### | |
def read_prompt(): | |
"""Enables pacing of dialogue of game.""" | |
raw_input(" Press Enter to continue ... ") | |
def opening_scene(): | |
"""Opening dialogue.""" | |
print """ | |
It is a cold December morning in Terryall, Colorado. | |
The trees are naked. The air is crisp. You can see your breath with every exhale. | |
In a desperate attempt to ward off the cold, you stuff your hands in your jacket pocket. Your phone vibrates. | |
""" | |
read_prompt() | |
print """ | |
It's a text from your friend Thomas. | |
>> meet me by the lake | |
""" | |
read_prompt() | |
def ending_one(): | |
"""The 'bad' ending. Displays scene.""" | |
print """ | |
bad end. | |
""" | |
def ending_two(): | |
"""The 'neutral' ending. Displays scene.""" | |
print """ | |
neutral end. | |
""" | |
def ending_three(): | |
"""The 'best' ending. Displays scene.""" | |
print """ | |
good end. | |
""" | |
def choice_one(): | |
print """ | |
Thomas' text is timestamped from 20 minutes ago. | |
Maybe you should text him back ... | |
1. Ask him how his morning was. | |
2. Tell him you're on his way. | |
3. Leave him on read. | |
""" | |
while True: | |
player_choice = get_player_dialogue() | |
if player_choice == "1": | |
first_tally = tally_update(2) | |
print """ | |
You text back: | |
>> good morning | |
>> how are you? | |
""" | |
read_prompt() | |
print """ | |
Your phone buzzes again. | |
>> :) hey | |
>> doing all right, thx | |
""" | |
break | |
elif player_choice == "2": | |
first_tally = tally_update(1) | |
print """ | |
You text back: | |
>> see u soon | |
""" | |
read_prompt() | |
print """ | |
Your phone buzzes again. | |
>> k | |
""" | |
break | |
elif player_choice == "3": | |
first_tally = tally_update(0) | |
break | |
else: | |
print "Please select a valid dialogue option." | |
read_prompt() | |
return first_tally | |
def choice_two(): | |
print """ | |
You and Thomas have never been that close. | |
He's, ah, what most would call 'a bit of a loner'. | |
That being said, you're pretty relieved to hear from him. | |
""" | |
read_prompt() | |
######### END OF ALL FUNCTIONS ######### | |
opening_scene() | |
tally = choice_one() # + second_tally Add additional tallies depending on number of dialogue choices. | |
# Note to self: All dialogue must be contained within choice_functions() in order to be printed in order because of how tally variable calls them. | |
ending_picker() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment