Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Jimmy Otis
3,228 PointsJust started the dungeon game. Feeling overwhelmed. Can someone give me a hint on how to draw the grid?
So I just started the dungeon game portion of this course. I'm feeling kind of stupid as I haven't really been this confused until now... The first thing I am trying to do is figure out how to draw the CELLS variable. Forget the monster, door, and dungeon, at the moment I'm just trying to figure out what way I would go about simply drawing a static grid. Can someone give me a hint as to what I would use to make it? Is it simply just the '_" and '|" characters run through a loop? Or do I need to import a graphics library?
1 Answer
Brian Boring
Courses Plus Student 3,904 PointsDon't get down man. I had to get a lot of help to get through that too. Pretty safe to say most people do. You don't need to import graphics libraries. The only thing you need to import is random (for starting locations of player, monster and door) and os (for clear_screen function). You are on the right track with using underscores and pipes to draw the map. For the CELLS variable, you'll need a list of tuples and each tuple will represent a cell location in the map based on the X and Y coordinates. The top left cell will be (0,0) and the bottom right will be (4,4). Get the pattern? So something like - CELLS = [(0,0), (1,0) ... (3,4), (4,4)]. Then to draw the map, loop through each CELL in CELLS and draw something out, qualifying it along the way. Qualifiers might be such as; is X or Y less than 4?, does the CELL value also equal the PLAYER location?, if it is not less than 4, how do you jump down to start the next row?, etc. I hope this helps without giving too much away. Good luck and keep at it!
Jimmy Otis
3,228 PointsJimmy Otis
3,228 PointsThanks Brian appreciate the much needed morale boost!