Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
loop adventure game
#1
i am trying to get the loop
to do if user press l go back to previous line
I've looked on the internet and can't find anything that did not pertain to math or advanced projects
if choice=='s':
  print("ok you've choosen  the sword. You see two doors. one is to the left and one is to the right")
  doors=input('Which door do you want to open? l or r ')
 if doors =='r':
     print('you are in an empty room. All there is you and your weapon of choice  ')
 elif doors  =='l':
     print("what are you doing here get out!"",""Some one yells. And punches you and stabs you. You have lost a live")
     lifes=lifes-1
     print('You now have a life total of: ' + int(lifes)

and if I do while True:. it will give me nothing
and now i am getting an error on line 21
Error:
Traceback (most recent call last): File "main.py", line 21, in <module> print('You now have a life total of: ' + lifes) TypeError: can only concatenate str (not "int") to str
and here is out put for when i don't have the error and i use while true
Output:
Welcome to the fart monster game ---------------------------------- What is your name d ok d here are the controls: g(grab),l(left),r(right),u(up),d(down) press n to start n ---------------------------------------------- You are thrown into a dark room. All you have is a knife and a rope tied around on your wrists and you take the the knife and cut the rope and you find the light switch and turn it on and see a sword and a dagger Which one do you want? s(sword) or d(dagger) s ok you've choosen the sword. You see two doors. one is to the left and one is to the right Which door do you want to open? l or r l what are you doing here get out!,Some one yells. And punches you and stabs you. You have lost a live >
Reply


Messages In This Thread
loop adventure game - by ilikedofs - May-25-2021, 11:52 PM
RE: loop adventure game - by bowlofred - May-26-2021, 12:43 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  While loop not ending (Best of 10 dice game) K3nidi 3 2,541 Jul-09-2022, 09:53 AM
Last Post: K3nidi
  For Loop and Use of Brackets to Modify Dictionary in Tic-Tac-Toe Game new_coder_231013 7 4,030 Dec-28-2021, 11:32 AM
Last Post: new_coder_231013
  how to make a hotkey for text adventure game myn2018 2 2,798 Jan-06-2021, 10:39 PM
Last Post: myn2018
  Choose your own adventure game noahc2004 2 3,573 Jun-26-2020, 02:06 PM
Last Post: DPaul
  Designing a "game" loop api pitosalas 2 3,456 Jun-07-2020, 03:20 PM
Last Post: pitosalas
  Waiting in a text adventure StickyLizard 1 57,869 Jan-19-2019, 10:45 PM
Last Post: ichabod801
  Errors in simple text adventure game? ecloev 5 6,965 Apr-10-2018, 05:55 PM
Last Post: nilamo
  loop doesn't advance-py3 text game foxtreat 2 4,431 Jun-08-2017, 06:41 AM
Last Post: foxtreat
  Need a little more help in a Choose Your Own Adventure Program Goldberg291 13 25,604 Jan-31-2017, 08:33 AM
Last Post: Ofnuts
  Python Text Adventure sneakyninja0129 2 32,317 Jan-01-2017, 09:18 PM
Last Post: ichabod801

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020