Computer Science Canada

How do I telling turing that the character has been selected

Author:  Spyro [ Sat May 22, 2004 11:33 am ]
Post subject:  How do I telling turing that the character has been selected

For my comp sci ISP, I gotta make a game...
One of the requirements are
Menu including : Choose character, enter game and exit game

Now I cant let the user play the game without selecting a character...
so if the user tries to enter without selecting a character, the program will tell the user and return to menu page.... now if the user selects a character.. how does turing know that....
like I dunno how to let turing know when the user have selected a character and when it hasnt and how to respond to each thing.......

please help

Author:  poly [ Sat May 22, 2004 11:39 am ]
Post subject: 

you could do it this way:
Lets say you have 4 characters, and there named 1,2,3,4.
make a variable called like characterchoice. Now when the user types in the character he wants it will set the characterchoice variable to either a 1,2,3 or 4.

Author:  Spyro [ Sat May 22, 2004 11:53 am ]
Post subject: 

What do you mean?
Like is there someway that I can hard copy what the user chooses so Turing can always refer to it?

I dunno what im doing....
Sad

Author:  MyPistolsIn3D [ Sun May 23, 2004 12:50 pm ]
Post subject: 

Does this help you out? Its how i structure menus.

code:
var choice : int
var check : boolean := false
loop
    put "What color do you want?"
    put "(1) Green"
    put "(2) Blue"
    put "(3) Red"
    get choice
    if choice = 1 then
        cls
        Draw.FillBox (100, 100, 200, 200, green)
        check := true
    elsif choice = 2 then
        cls
        Draw.FillBox (100, 100, 200, 200, blue)
        check := true
    elsif choice = 3 then
        cls
        Draw.FillBox (100, 100, 200, 200, red)
        check := true
    else
        put "Incorrect input, Try again."
    end if
    exit when check = true
end loop


: