[Tutor] Coding for a Secret Message in a Game

spir denis.spir at gmail.com
Fri Dec 13 12:40:02 CET 2013


On 12/13/2013 05:10 AM, Sky blaze wrote:
> Hi, I'm a newbie Python programmer. I was introduced to Python via the Hour
> of Code, and after completing all three of Grok Learning's tutorials, I was
> inspired to create a text-based RPG adventure. I composed this e-mail after
> searching for a forum for Python, and this address showed up in one of the
> results.
>
> Due to my inexperience with Python, I'm having trouble creating a code for
> one of the things I wanted to do for the game. The game starts out on a
> "title screen" with a message saying, "Type 'start' to begin!" I thought
> it'd be amusing to have the message change after the player types something
> other than "start" at least 10 times. I've attempted numerous times to code
> this, but all of them have failed. Could you help me with the coding? It
> should look something like this in the end:
>

Welcome to Prog Land!

Others have answered about counting in a loop. Here are a few other comments:

As you obviously have understood by yourself, one wonderful thing with 
programming is that we can do what we want, as we want it. We can invent worlds, 
like what you have in mind for an RPG. It frees imagination.

However, like any complicated domain, there is problem of dimension. If you want 
to enjoy programming for a long time, instead of being quickly fed up, maybe 
consider sizing your projects according to your knowledge & experience -- as 
well as energy & time available.

A trick is to explore and develop little bits that can be run or tested 
independantly, while they let you discover and learn how to do things. Something 
challenging enough to be fun, but that won't let you in the dark for years. This 
user-input problem you chose is a good example for start, i guess.

Some possibilities; how to:
* simulate dice, like 2d10, and have events show up with given probability
* define an output format for user interaction
* define a character/monster with given properties (strength, speed, HPs...)
* store objects and special capacities on beeings (units)
* represent a playing land with rooms and pathes (dungeon)
* find a path
* connect objects/capacities with actions (a key for a door open)
* represent the logic of game events (when this and that, then thut)
* represent the logic of game progress (they've reached this point of the objective)
?

Thanks for sharing your excitement! If you go on your RPG (and even if not), 
this mailing list is here for help. You'll have to learn about functions of 
different kinds and various data structures, how to have them serve you, not the 
opposite, how to let them interact while not ending up with a big mess out of 
comprehension...

Denis


More information about the Tutor mailing list