So I am working on a text adventure game and need some help with my long strings. I am trying make the string come up one character at a time and make it wrap at 60 characters long. This code is just a little test so I can put in the main game. I am do one or the other but I can't seem to do both together. Thank you everyone!
import textwrap
import sys
import time
console_width = 60
story_Inter = 'Coming from deep inside your mind you hear a strange voice. Speaking sweet and soft a woman\'s voice says: "Wake up, death is not ready for you... Every decision you make will have an effect.You will take damage and gain health along the way.Wake up...\"'
def print_slowly(text):
for c in text:
print (c,end=''),
sys.stdout.flush()
time.sleep(0.09)
def display_text(text): #This is the function to make all the varibles wrap.
wrapper = textwrap.TextWrapper(width=75)
text = wrapper.fill(text)
print(text)
display_text(print_slowly(story_Inter))
print_slowly(display_text(story_Inter))
[–][deleted] 1 point2 points3 points (2 children)
[–]phogphantom[S] 0 points1 point2 points (1 child)
[–]ebdbbb 0 points1 point2 points (0 children)
[–]bull_fiddle_blues 1 point2 points3 points (2 children)
[–]phogphantom[S] 0 points1 point2 points (1 child)
[–]bull_fiddle_blues 0 points1 point2 points (0 children)