Text Based Dungeon Game in Python | Coding Tutorial

Поделиться
HTML-код
  • Опубликовано: 20 июл 2024
  • I walk you through making your own text-based game in Python.
    This is a simple project using a dictionary and a few loops.
    This project is similar to the SNHU IT-140 project. Do not copy my work as it will be detected by TurnItIn and you will get a zero.
    View the Repository:
    github.com/dante0527/TextBase...
    Use LucidChart Free:
    lucidsoftware.grsm.io/ofzld28...
    Join our Discord for 24/7 coding support:
    / discord
    50% off Codecademy Pro, Plus, or Pro Student annual plan
    codecademy.referralrock.com/l...
    Chapters
    0:00 - Intro
    0:13 - Designing Map
    0:34 - Functions
    1:24 - Coding Map
    2:31 - Tracking Variables
    3:16 - Gameplay Loop
    4:08 - Item Indicator
    5:13 - Boss Encounter
    6:17 - User Input
    7:35 - Moving Between Rooms
    8:11 - Picking Up Items
    9:02 - Exit Game
    9:14 - Input Validation
    9:26 - Demo
    10:31 - Additional Features
    11:01 - Outro
    Subscribe to my Channel:
    / @dantecoding
    #python #coding #programming #codingtutorial #technology #tech #engineering

Комментарии • 125

  • @vebtrex9416
    @vebtrex9416 11 месяцев назад +10

    this guy that me in a minute more than other tutorials did in 10 min. great job

  • @brookestephen
    @brookestephen Год назад +4

    Nice! A directed graph is a good first step! The edges could represent lockable doors with traps... whose state depends on the user submitting the correct Command objects in the right sequence, or even randomly.

  • @beniaminocogoi5806
    @beniaminocogoi5806 Месяц назад +1

    Defo one of the best tutorials ever. I think you have a gift in explaining briefly and clearly. Looking forward to the next video.

    • @DanteCoding
      @DanteCoding  Месяц назад +1

      Thank you, that means a lot! I have been planning on uploading more, just got a new job so should be coding more

  • @bobibibobibjhhlk4876
    @bobibibobibjhhlk4876 9 месяцев назад +3

    You have helped me so much, I’ve been struggling to understand the proper syntax’s the first RUclips video I’ve seen to be helpful with coding, now I finally know the use for flowcharts lol

    • @DanteCoding
      @DanteCoding  9 месяцев назад +1

      that is so great bobibibobibjhhlk4876, i’m glad i could help

  • @trinitymilagro9155
    @trinitymilagro9155 Год назад +9

    Awesome, I have a final project with a game so definitely taking your video as a base! Great explanation. Thanks so much

    • @DanteCoding
      @DanteCoding  Год назад +1

      Glad it could help! This video is based on that project if it’s the class i’m thinking of

  • @joanneyates755
    @joanneyates755 Год назад +4

    Thank You Thank You Thank You. This is a great video tutorial that actually explains the process of programming this type of game. The other videos I have watched were so confusing. I am not a computer person but am required to take this python course for my degree. This course has been very difficult for me and have had to look up most of the answers. This video is going to help guide me while programming my own version of this game. Again, Thank You.

    • @DanteCoding
      @DanteCoding  Год назад +1

      Yay! So glad it could help, good luck with the course!

  • @supermalavox
    @supermalavox Год назад +11

    10:49 Ironically, for a blind person using a screen reading program, if there are no images, it is better. That's why I like games such as Colossal Cave Adventure, because they are text-only games! Anyway, great video!
    By the way, I use VS Code too, especially because they are putting accessibility features like sound warnings if there is something wrong with the code and a screen reader is detected!

    • @DanteCoding
      @DanteCoding  Год назад +1

      That’s an awesome perspective, I didn’t know that about VS Code, but i’m happy to hear they have accessibility features like that. Accessibility is something that is emphasized a lot in good software courses, which is important because developers without disabilities might overlook it. The great thing about VS Code (and some other editors) is that even if they didn’t have that support, someone could make an extension for it.
      I’m curious, do you have any other opinions on accessibility features or pain points you experience with common software? I notice a lot of design flaws in big tech software, but I imagine there’s even more to say from a visually impaired perspective.
      Personally, I have keratoconus, which makes my vision really blurry, so I have to code with a hard contact in, but it’s still not perfect. All I really have to do is zoom in though, but then I lose screen real estate, making me want to get a laptop with a larger screen, but then it’s a lot heavier and I prefer light laptops since I carry them around a lot.
      Thanks for the feedback!

    • @supermalavox
      @supermalavox Год назад +2

      ​@@DanteCoding, I think that a good way of noticing what could be done to put accessibility in softwares is to play audio games like Swamp, A Blind Legend, Shades of Doom and some other games. If you play those games, you will notice that volume changes, stereo positioning and even sound alerts when you are playing a platform game and your character is close to a pit are good examples of what can be done. Oh, spoken menus, either by pre-recorded voice or tts, are also necessary if you are going to make a game sighted people can play as well, since OCR normally doesn't detect some types of writing!
      Thanks for the quick response and interest in the topic!

    • @DanteCoding
      @DanteCoding  Год назад +1

      Sound design in games plays such a huge role in immersion and the overall experience, I think a lot of people don’t appreciate what it can do, even for sighted people. Hotline miami is one game in particular that leverages music volume, tempo, and tone to convey the mood and story level by level, and is one of the first things people mention when raving about it. It’s really incredible what sound brings to the table. Even a lot of open world games use subtle alerts to indicate nearby hidden items.
      One more question, how do you go about debugging code without using syntax highlighting, call stack, et cetera? I sometimes worry that if my condition were to progress, i’d have a really hard time coding. I consider myself a very visual learner, I get the most fulfilling experience once I can visualize a concept in my mind. It’s inspiring and motivating to hear your input :)

    • @supermalavox
      @supermalavox Год назад +2

      ​@@DanteCoding, I hope your condition never gets worse, but if it does, you'll certainly have more accessibility than years ago. For example: syntax highlighting is the reason why VS Code now has sound cues when there's error in that line of code. However, if I'm not mistaken, it just works if a supported screen reader, such as NVDA on Windows, VoiceOver on MacOS or ORCA on Linux is turned on.
      As for call stack, at least in Python, traceback information helps to find out where the error occurred. But I confess to you I am not a professional programmer so I might not be the best person to talk about it. I am more of a curious person and got interested in the topic of programming because NVDA itself is built in Python and SoundRTS - an audio game - too.
      Speaking of games, SNES' Killer Instinct also changes its song a bit when you can start an ultra!

  • @JoshCeschiniPB
    @JoshCeschiniPB Год назад +1

    Thanks man. Super Informative video. Helped me a ton

  • @beksbad
    @beksbad 9 месяцев назад +1

    Thank you so much! This video helped me a lot!

  • @tinkachu8743
    @tinkachu8743 Год назад +2

    Noice, this is literally what I have to make for my Python class and I was stumped lol.

  • @Freshstanced
    @Freshstanced 11 месяцев назад +1

    You are a lifesaver man!

  • @timrudenko9970
    @timrudenko9970 Год назад +1

    Amazing!

  • @albertoguadiana1008
    @albertoguadiana1008 9 месяцев назад +1

    very very nice ty you for the info

  • @Pintobean-vx3ez
    @Pintobean-vx3ez 29 дней назад +1

    Hey man you really helped me with my project, thanks! Also can I ask where else did you learn python or coding in general? you seem pretty advanced and comfortable with the language

    • @DanteCoding
      @DanteCoding  28 дней назад

      Hey, glad you found the video helpful!
      I learned Python with Codecademy, which I still recommend to a lot of people if you can afford it. It’s very thorough and the intro courses hold your hand through learning all of the main concepts of programming, using whichever language you choose.
      However, you do not need to pay money to learn programming. There are tons of resources on RUclips and a TON of really good websites. When I was learning I made a discord and posted a bunch of my notes on there as google docs, and sent a bunch of links to cool websites that I found helpful (link in description and on my channel).
      The main difference is you kind of have to go out and find the information yourself if you want to learn for free, it’s not hard to find but I think Codecademy does do a great job of teaching you the basics efficiently.
      If you do you choose codecademy, do not pay full price because it is pretty expensive. There are some free smaller courses on there but most of the bigger courses you need a membership for, students get 35% off, or if you use my link in description you get 50% off of a yearly membership and I get a $20 amazon gift card. I am not just shilling this website I actually believe it is really good, but definitely look into it or watch some reviews before you spend money.
      Above all though, it’s just time spent coding. The more you play around, the more tiny tricks you learn and it all adds up eventually. I believe that school is not enough to get you super comfortable, you have to go out and code and learn extra stuff, I found that messing around with school projects helped me a lot because it gave me a starting point, and I was able to reference old projects for little bits of code to use in other projects. Save everything to GitHub. I cannot tell you how many times I went back to some random repository with like 20 lines of code in it just to grab that one function that I never thought worked, because I found a use case for it in a new project.
      There’s a lot to say and a lot of opinions people have about how to learn, but as long as you carve out time to sit at a computer and google random stuff, you will eventually become very comfortable with anything.

    • @Pintobean-vx3ez
      @Pintobean-vx3ez 23 дня назад +1

      ​@@DanteCoding Hey man tysm for replying and the great info! I'm nearing the last week of the it 140 course and realized it didn't teach nearly as much as I needed to know, so this is awesome info to have. I'll definitely take a look at the discord you provided and if I decide to go with codeacademy, I'll be sure to use your link! Thank again for the reply and info :)

  • @philtoa334
    @philtoa334 Год назад +1

    Very nice.

  • @UE5tutorial
    @UE5tutorial 8 месяцев назад +2

    thanks

  • @charmainemorala6329
    @charmainemorala6329 Год назад +1

    Thankk you for thiss oneee !!!!
    How do you load the image to your program?? Like if you will submit it will that be included ??

    • @DanteCoding
      @DanteCoding  Год назад +1

      if you put it in a folder with the python file you can just submit the folder, but you may have to compress the folder to be able to submit it. you don’t necessarily have to do the image part though, that was just an extra feature I put in as an example

    • @charmainemorala6329
      @charmainemorala6329 Год назад +1

      @DanteCoding ohh thank you.. well the picture is much better than the print .. Thank you..

  • @anuraexe
    @anuraexe Год назад +1

    thank you for the great video!
    does anyone know a simple way to like upload ur game to something to share ur game with those that don’t have an interpreter?

    • @DanteCoding
      @DanteCoding  Год назад

      there’s ways that you can package a program up into an executable, not sure how to do it with a command line program though. definitely worth googling around for this, i’m sure you could find something

  • @deepatterson1894
    @deepatterson1894 2 месяца назад

    I am bummed seem to be the only one with a problem with the PIL image. causing to crash. Seems like a add-on but I don't know what it is tried to find it in vs code. I installed PILLOW something is wrong.

  • @jacobmccarthy1055
    @jacobmccarthy1055 Год назад

    Hey man, quick question, when I input clear(), it isn't clearing but printing a " instead. I'm using pycharm if that helps out any.

    • @DanteCoding
      @DanteCoding  Год назад

      u copied the whole clear function? and imported os? it should work, if not send me a DM on instagram @dxntelee

  • @UE5tutorial
    @UE5tutorial 8 месяцев назад +2

    bro that s alot im new and i wanted to make a dungen crawler for my brother

  • @user-qj2pf6cg2g
    @user-qj2pf6cg2g 4 месяца назад

    Do you think for this, there'd be a way to have combat or levels, similar to a traditional RPG? I've got an assignment to do, where I need to have some form of combat or levels in my game.

    • @DanteCoding
      @DanteCoding  4 месяца назад

      yeah, just add a counter variable and every time you get an item increment it by 1 or something. you could get pretty creative with it

  • @deepatterson1894
    @deepatterson1894 2 месяца назад +1

    Got code to run but had to comment out all the image stuff

  • @MegaStrega
    @MegaStrega Месяц назад

    Question I'm working on making this but I'm doing something quite different, Would it be considered copying to use the same structure but different variables/rooms/items/gameplay loop etc? My initial plan didn't involve clearing the screen for example but I may take that into consideration now

    • @DanteCoding
      @DanteCoding  Месяц назад

      Do not copy too much! If you submit and the code matches too closely, it may get flagged. While most of the programs will be roughly the same, TurnItIn can detect an exact percentage of how similar your file is to others’; however, if you want to reference my code and see if you can find where your error may be, all of the code from the video is on my GitHub, linked in the description of the video.
      To answer your question though, yeah you should definitely start with creating your own dictionary values, all dictionaries for this project should look pretty much the same, same structure aside from the values, and as long as you understand the fundamentals of this project you can get even more creative.
      Good luck, and feel free to ask as many questions as you need!

    • @MegaStrega
      @MegaStrega Месяц назад

      @@DanteCoding anyway i could share where I'm at so far somehow and get feedback? My project is due Sunday

    • @DanteCoding
      @DanteCoding  Месяц назад +1

      yeah if you want you can join my discord in the description / under channel info and say something in there, i’ll respond and help u before sunday

  • @usarmyvet3id
    @usarmyvet3id 3 месяца назад

    This video is absolutely fantastic. The code works incredibly well, but at 8:55 I keep getting PEP8 violations for the bare excepts in the try blocks and I’m stuck.
    Is anyone else seeing this?

    • @DanteCoding
      @DanteCoding  3 месяца назад

      you can ignore those for the most part but if you want to have it correct for the sake of pep8 you can do except: pass under it which basically does nothing

  • @shadoweagle2432
    @shadoweagle2432 Год назад +1

    Why would you use a dictionary to store your map? Your map is a pretty traditional graph and would make more sense to denote with nodes and edges instead of a dictionary. Also maybe adding str.toLower() to the strings to check without capitalization would be a nice touch. Otherwise awesome job man! Make some more vids!

    • @DanteCoding
      @DanteCoding  Год назад

      Thanks for the input! I’d like to learn about the node/edge approach, maybe you could show me soon. As for the strings, I used title case to normalize them because it looks nice in the output, making the items seem like they have a title. All input gets normalized to title so it accepts any case.
      I’ll definitely be making more videos, I have two more games planned to get video making experience, and then gonna get more technical and do tutorials in C++ and Java. Appreciate comments like this

    • @shadoweagle2432
      @shadoweagle2432 Год назад +1

      @@DanteCoding ahh I missed the .title() method. Can't say Ive used that one before, good to know. Also I can definitely show you nodes/edges for graphs. Have you done graphs in class before? Graph theory or actually programming graphs?

    • @DanteCoding
      @DanteCoding  Год назад

      @@shadoweagle2432 We covered graph theory in discrete math so i’m familiar with nodes and edges, never done it in programming though.

    • @shadoweagle2432
      @shadoweagle2432 Год назад +1

      @@DanteCoding now that Im thinking about it your dictionary is essentially just an adjacency list (one of the ways to represent a graph) the dictionary implementation is actually a good choice since unlike most graphs the different edges have directions and names associated with them. Using a more traditional representation would actually probably come out messier. My original thought was to make nodes that point to other nodes kinda like a linked list, but that also might make things overly complex.

    • @DanteCoding
      @DanteCoding  Год назад

      @@shadoweagle2432 Oh yeah I remember adjacency lists, that makes sense. I think it also helps because this video is targeting beginners

  • @ruthlessadmin
    @ruthlessadmin 8 месяцев назад +2

    What I like about this, is you didn't use any classes. I was guilty for a long time before I learned C, which is a paradigm shifter on many levels. Now I find it so frustrating to see people over use & abuse them in object oriented languages. They should be avoided at all costs, unless you're overriding someone else's bad design or modifying functionality of a built-in object.

    • @DanteCoding
      @DanteCoding  8 месяцев назад +2

      agreed. classes are a lot of fun and very useful, but don’t need to be overused especially for a simple scripted game like this

  • @TruSuCiO23
    @TruSuCiO23 Год назад +1

    I was wondering how can we give the player the ability to see possible exits for each room when they are in the lets say bedroom and you can go N or W for example without having to just blindly guess.

    • @DanteCoding
      @DanteCoding  Год назад +1

      this is a great idea to play around with!
      inside the gameplay loop that runs every turn, one of the things we do is check if there’s an item, and if there is we tell the player. imagine if before we did that, we just checked if the map (dictionary)’s keys contained “north, south, east, or west”, and printed out the value and key (room and direction).
      to start, we already have a variable declared called “current_room” and we used it before by doing current_room.keys() which returns a list of cardinal directions (north, etc.) that the player can travel from the current room. we used it to check for an item, which is also in that list if it exists in the room. instead of checking just the keys, we could do something like this:
      for direction, room in current_room.items():
      print(direction, room)
      and you can use f-strings to format this in a more creative way
      this would help you practice print formatting, as well as iterating through a dictionary. both very useful skills!
      please let me know if you give this a shot, i’d love to see it. and if you end up getting stuck and can’t figure it out, let me know and i can get on a call with you

    • @TruSuCiO23
      @TruSuCiO23 Год назад +1

      @@DanteCoding awesome thanks, this will definitely help complete my game! Was having plenty of trouble trying to add this without causing issues or it not working as intended.

    • @DanteCoding
      @DanteCoding  Год назад

      @@TruSuCiO23 sweet, let me know how it goes

    • @TruSuCiO23
      @TruSuCiO23 Год назад +1

      @@DanteCoding I wasn't able to get it to work and while working my regular job at the same time, I pretty much ran out of time. So at least I was able to submit a completed project. I will still give it a go on my own as this helps with practice and for any future projects I might encounter.

    • @TruSuCiO23
      @TruSuCiO23 9 месяцев назад +1

      ​@@DanteCoding Months later! and I finally circled back to it and was able to figure it out! I ended up using the below
      def display_exits(room):
      exits = [key for key in rooms[room].keys() if key != "item"]
      print(f"Possible exits: {', '.join(exits)}")
      Currently in C++ class and I honestly prefer python over it and Java which i took after the python class. Will def continue to hone my skills on python once i complete everything.

  • @charlessimpson6852
    @charlessimpson6852 5 месяцев назад

    Quick question, I typed everything out but it won’t move from the first room. So I copy and pasted your code and same thing, it never moves from the first room. I’m using pycharm, do you know what the problem could be? Thanks man

    • @DanteCoding
      @DanteCoding  5 месяцев назад

      That sounds like it could be anything, i’m assuming you aren’t getting an error message either. Maybe try it in VS Code and if you copy my code exactly and it still doesn’t work then it’s prob something with your python interpreter. I have had similar problems with PyCharm before, sometimes the solution is as easy as closing the folder and restarting pycharm, sometimes it just doesn’t work for seemingly no reason, that’s kind of why i stick to VS Code bc it’s just an editor and less prone to messing with python stuff. If you still can’t get it to work let me know

  • @cena5522
    @cena5522 Месяц назад +1

    Hello! This was very helpful to me but there is one issue I need assistance with. I keep getting syntax error when using the break after the Exit command. Do you know why that is happening?

    • @DanteCoding
      @DanteCoding  Месяц назад

      what’s the specific error saying? maybe indentation? hard to tell without seeing it, but remember to always check the line number that the error is being thrown from

    • @cena5522
      @cena5522 Месяц назад

      @@DanteCoding it says 'break' outside of loop

    • @DanteCoding
      @DanteCoding  Месяц назад

      @cena5522 yeah that means you have to indent the break into the loop, break should be one more indentation to the right than the start of the loop

    • @cena5522
      @cena5522 Месяц назад

      @@DanteCoding for some reason it still doesn't work even if I indent

    • @DanteCoding
      @DanteCoding  Месяц назад

      @cena5522 still the same error? you can reference my code on github link in description if you want to check it out

  • @Daz30
    @Daz30 Год назад +1

    Where do we get the Pil module? Im using pycharm and gives me an error about module not found.

    • @DanteCoding
      @DanteCoding  Год назад

      you have to pip install it, so in your command line type ‘pip install pillow’ i’m pretty sure, and then at the top of your file import the same thing I did in the video, pretty sure ‘from PIL import ___’ something i forgot what it was but it’s in the video

    • @reckingcrew2277
      @reckingcrew2277 Год назад +1

      @@DanteCoding Does this work on Mac? Its not working for me

    • @DanteCoding
      @DanteCoding  Год назад

      @@reckingcrew2277 yes it does, i use mac in the video. did you pip install/ pip3 install? i could hop on a call and help you if you want but this isnt a requirement if you’re doing it for school

    • @reckingcrew2277
      @reckingcrew2277 Год назад +1

      @@DanteCoding pip install didn't work but pip3 install did, I guess that fixed it, thanks!

    • @DanteCoding
      @DanteCoding  Год назад

      awesome, yeah on mac sometimes u have to use pip3 for some reason. now that it worked for you, you know pip3 works with the interpreter you’re using which is python 3. just using pip probably installs packages to the installation of python 2 that comes with mac by default.

  • @CycloopsDBD
    @CycloopsDBD Месяц назад +1

    No matter what i change, whenever i pick up an item it says "cant find item" even when the item is there

    • @DanteCoding
      @DanteCoding  Месяц назад

      Check the code on my GitHub (link in description) for reference, there’s definitely some small syntax error somewhere. If you want further help just let me know or send me a DM on instagram

  • @KI11T
    @KI11T 8 месяцев назад

    Hello - How do you make the game end once all items are retrieved. For some reason, because the 'villain' is listed as an item, it wants me to retrieve it. How can I make it so the game ends once all items are picked up and you reach the room the villain is in? I tried your code but after running it, it's like there is no end saying the game is beat. Can you tell me if I missed anything?

    • @DanteCoding
      @DanteCoding  8 месяцев назад +1

      It depends on the code, but check your conditionals and make sure when you check if the item value is the name of your boss in the dictionary, that it triggers the end of the game. the end is another conditional, stating that if you have all the items you win, and if you don’t then you lose

    • @KI11T
      @KI11T 8 месяцев назад +1

      @@DanteCoding Thanks so much! I went back over it and updated item values in a few places then it worked. Thank God.

    • @DanteCoding
      @DanteCoding  8 месяцев назад

      @@KI11T awesome, glad it’s working now

  • @kelvintran5941
    @kelvintran5941 Год назад +1

    Hey bro did you use pycharm to make this text based game ?

    • @kelvintran5941
      @kelvintran5941 Год назад +1

      Currently having issue on the item pickup and inventory part in making my game for my project.

    • @DanteCoding
      @DanteCoding  Год назад +1

      I used VS Code but it should be the same. The github link to my code is in the description if you want to reference that

    • @kelvintran5941
      @kelvintran5941 Год назад +1

      Alrighty thank you !

  • @karamcdonald1662
    @karamcdonald1662 3 месяца назад

    This video has helped me A LOT with understanding what I'm to be teaching myself through this terrible online course. That said, when I code for the moving between rooms and get item branches: rooms[current_room][direction] and if item == [current_room]["item"], I receive an error on pycharm that states Name 'direction' and Name 'item' are undefined.
    I noticed in your def prompt that both {direction} and {item} were highlighted. My code isn't doing that and is just treating these as strings, not variables. How could i fix this to where they're recognized as variables, so they don't show as undefined when I am creating my branches?
    It's odd because I have item and the north, south, east, etc in my rooms dictionary, but it doesnt register that these are variables.
    Anything helps please, this is baffling me to no end.

    • @tinypopura
      @tinypopura 3 месяца назад

      I'm doing that same course as well, it's a struggle lol. That said, I wrote my code a bit differently than the video. Is your variable defined outside the loop? They won't work otherwise.

    • @karamcdonald1662
      @karamcdonald1662 3 месяца назад

      @@tinypopura I defined direction. That's fine. But then for items, I am unsure how to define them when they're already in the rooms dictionary. Should I make a separate dictionary for the items and what rooms they're connected to? Or just make a list with item names? How did you structure your item variable? At this point, code is working great until I try to claim any item in a room. Bam, can't find item, even though it shows it's in the room. I also want to code for an item description when the item first pops up in a room. Any tips will help! Online forums are kind of showing mixed answers and I don't want to make this more complicated than it needs to be.

    • @DanteCoding
      @DanteCoding  3 месяца назад

      @karamcdonald1662 You’re really close, I believe this is a very minor syntax error you’re experiencing. If you want you can take a look at the code on my GitHub, link in description. It’s a little hard to troubleshoot these things through comments but if you want I don’t mind getting on a call. As far as adding descriptions for the items, there’s a few ways to do that too, I think for a game like this if you wanted to add much more depth to it beyond something like item descriptions, I would probably take a totally different approach like creating a whole item class with description attributes etc, but if you want to keep it simple this is still possible, you can add another key to each rooms dictionary called “description” with a string value and then print it whenever a new item is encountered. I hope this makes sense, like I said it’s a bit tough to explain in a comment but I hope this helps!

    • @tinypopura
      @tinypopura 3 месяца назад

      @@karamcdonald1662 If your item is already in the dictionary ( I assume as 'Item': 'Some Item') , you could do something like:
      if 'Item' in rooms[current_room].keys():
      abc = rooms[current_room]['Item']
      with the variable abc being what calls the item in the room you are currently in. I did something similar to you for descriptions in my code. What worked for me was a def method. But you could also call it in the loop as is, though it will look like an ugly mess of if, elif statements
      if 'Item' in rooms[current_room].keys():
      abc = rooms[current_room]['Item']
      if abc == 'Some Item':
      print('You see something in the corner of the room. lorem ipsum yadda yadda ')
      elif abc=='Other item':
      print('Some text about other item')
      Of course, I don't know your code, so it may not even work. The hardest part about this the loops. I struggled for hours trying to figure out why my code wasn't working, only to get it working when I placed my code in a different loop.

    • @karamcdonald1662
      @karamcdonald1662 3 месяца назад

      @@DanteCoding I'm wildin that I didn't review the full code on GitHub. I see now that you added item and direction variables. Simple enough and now I've over-thought it. It is fixed! But I really want to take this up a level for immersion. I do want to add those item descriptions. And possibly room descriptions upon entry? Do you have discord?

  • @aaronelder861
    @aaronelder861 Месяц назад

    I am new to programming and python is my first language. I tried copying the def prompt(): but im getting ( not closed and string literal undetermined errors, any ideas? Im pretty sure ive copied it exactly but...

    • @aaronelder861
      @aaronelder861 Месяц назад +1

      Nevermind, I did not have it copied exactly 🤷🤦

    • @DanteCoding
      @DanteCoding  Месяц назад +1

      there’s gotta be an unclosed parentheses somewhere, and for the string thing u are probably referencing a string that isn’t there. you can reference the code from my github, link in description if you want to double check

    • @aaronelder861
      @aaronelder861 Месяц назад +1

      I truly appreciate the quick reply, you got a sub 👍

    • @DanteCoding
      @DanteCoding  Месяц назад +1

      @aaronelder861 thanks brotha, good job with the code!

    • @aaronelder861
      @aaronelder861 Месяц назад

      Thanks man! Every bit of encouragement helps for real!

  • @user-mw2ed2bf1x
    @user-mw2ed2bf1x Месяц назад

    I tried to use item in mine as well but it keeps telling me that item is an unresolved reference. I have looked back in your code and do not see where you have referenced it. So none of the #pick up items, code I made will work.

    • @DanteCoding
      @DanteCoding  Месяц назад

      hmm, did you make sure you are referencing it with quotes and with the same capitalization? it should be a string in the dictionary too. sounds like a small syntax issue

  • @giovannygallardo-garibay4862
    @giovannygallardo-garibay4862 Год назад +1

    What is your purpose for the vowels?

    • @DanteCoding
      @DanteCoding  Год назад +1

      The list of vowels is used from 4:15-5:10 so the program can decide whether to say “You see a {item}” vs “You see an {item}” vs “You see {item}”. This will dynamically change if the item starts with a vowel, or is plural. It checks if the first letter of a given item is a vowel, or if it has an ‘s’ at the end for plural. Hope this helps!

    • @giovannygallardo-garibay4862
      @giovannygallardo-garibay4862 Год назад

      @@DanteCoding would it matter if my item names are different from the vowels ? Or should they be corresponding with the item name?

    • @DanteCoding
      @DanteCoding  Год назад +1

      This program is set up so that you can change any of the room names and any of the item names to whatever you want them to be, and it should still handle them correctly. That’s what the checks are for. Typically at the beginning of a function or a loop, like our gameplay loop in this video, if you want to perform checks on anything you will use conditional statements with if, elif, and else, before having the program take any further action. Let me know if you want an explanation on anything else, and if it’s still confusing I can hop on a call and walk you through it :)

    • @giovannygallardo-garibay4862
      @giovannygallardo-garibay4862 Год назад +1

      @@DanteCoding hey I really appreciate you and yeah another day would work if you have time and I followed you on Instagram( so it’s easier to text you )

    • @DanteCoding
      @DanteCoding  Год назад

      perfect

  • @TaylaAshbrook
    @TaylaAshbrook Год назад

    where did you get the 27 from?

    • @TaylaAshbrook
      @TaylaAshbrook Год назад

      mine keeps repeating the empty inventory over and over again, can you help me?

    • @DanteCoding
      @DanteCoding  Год назад +1

      27 is just the number of dash characters you want to print on that line, it just happens to be that 27 fits the width that i wanted but you can use any number

    • @DanteCoding
      @DanteCoding  Год назад +1

      @@TaylaAshbrook if you’re stuck in an infinite loop, look at what other statements are in the same level of indentation. what else should be executing? if it’s in your “while True” loop, it won’t stop looping unless you ask the user for input before the start of the next iteration of the loop. i hope that makes sense, but if not just try rewinding the video or keep watching and it might make sense after. stick with it!

    • @TaylaAshbrook
      @TaylaAshbrook Год назад +1

      I just want to say thank you! Your video was the only one I could understand, and it helped me out a lot. Hopefully I will get better over time.

    • @DanteCoding
      @DanteCoding  Год назад

      Of course! You will get better just stick with it, I don’t think being “good at coding” is a big factor, it’s a lot more about who spends time doing it. You got this

  • @dreamleaf6784
    @dreamleaf6784 3 месяца назад +3

    Did you graduate yet? I have a year left. If you did graduate. Did you get uo getting a job? Market is getting a little better now

    • @DanteCoding
      @DanteCoding  3 месяца назад

      I graduated in December, didn’t try very hard to get a job until a couple weeks ago. I’m seeing some good openings near me but there’s a ton of people applying to the same jobs I am. What makes you say it’s getting better? I could use some hope lol

    • @dreamleaf6784
      @dreamleaf6784 3 месяца назад +1

      @@DanteCoding they had a lot of layoffs last year. My wife lost her job and has been able to replace. But it just seems like there is more stuff opening up. I do hope it's better next year when I graduate.
      I plan on making a good resume and machine gun applying for junior dev jobs or testing. Good luck!

    • @DanteCoding
      @DanteCoding  Месяц назад

      I got a job lol

    • @dreamleaf6784
      @dreamleaf6784 Месяц назад +1

      @@DanteCoding grats! That's awesome.

    • @DanteCoding
      @DanteCoding  Месяц назад

      @@dreamleaf6784 how’s everything going on your end?

  • @stevenl.1439
    @stevenl.1439 4 месяца назад +1

    i broke you 555 likes sorry :)

  • @ethana1
    @ethana1 2 месяца назад +1

    nice1 !