[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Enter name before game starts



I've done that with a rudimentary menuing system.  Basically I kept a variable telling the main loop which "context" it was in, like "main menu" "main game" etc...  In the main loop, it checked to see which context it was currently in, and from there decided what to do with keypresses/inputs and screen drawing.   This worked well since the program needed to go back and forth between regular gameplay and menus and whatnot.  

-Lee-

On Mon, Apr 26, 2010 at 10:45 PM, Ian Mallett <geometrian@xxxxxxxxx> wrote:
A super kludgey way:

name = raw_input("Type your name here -> ")

If you want a graphical interface, just make a simple looping program to do so before the main enters.  It's not too hard (especially in comparison to what the rest of your code likely looks like!)  I've used this technique quite successfully in some of my games. 

Ian