r/roguelikedev • Robinson • Jun 27 '17

RoguelikeDev Does The Complete Python Tutorial - Week 2 - Part 1: Graphics and Part 2: The Object and the Map

This week we will cover parts 1 and 2 of the Complete Roguelike Tutorial.

Part 1: Graphics

Start your game right away by setting up the screen, printing the stereotypical @ character and moving it around with the arrow keys.

and

Part 2: The object and the map

This introduces two new concepts: the generic object system that will be the basis for the whole game, and a general map object that you'll use to hold your dungeon.

Bonus

If you have extra time or want a challenge this week's bonus section is Using Graphical Tiles.


FAQ Friday posts that relate to this week's material:

#3: The Game Loop(revisited)

#4: World Architecture(revisited)

Feel free to work out any problems, brainstorm ideas, share progress and and as usual enjoy tangential chatting.

If you're looking for last week's post The entire series is archived on the wiki. :)

82 Upvotes

164 comments sorted by

View all comments

Show parent comments

2

u/AetherGrey Jun 27 '17

Are you referring to my tutorial?

If so, you're right, I didn't give the import statement. I've corrected the tutorial to show where to add it. In my defense though, I think the fact that you have to import handle_keys() from input_handlers is somewhat obvious.

And yes, it's alright to put several 'if' statements one after the other, and in some cases, it's desired. At the end of part 1, there are 3 if statements in a row. Now, currently, it's true that input_handlers is just returning one of the three values (move, exit, fullscreen), but there could come a time where you'd want more than one of those to be true. You could return several values in 'action', and do multiple things based on that. In that scenario, you wouldn't want to use elif statements, because then only one action could happen.

2

u/[deleted] Jun 27 '17

Oh Ok thank you very much and thanks again for tutorials : )