View Single Post
Working with variables
Old
Shibble
Junior Member
 
Status: Offline
Posts: 5
Join Date: Sep 2011
Default Working with variables - 10-17-2011, 11:13 AM

Hey Guys,

I was hoping someone could help me out with a little project for school..

Here's the thing :

For my tic tac toe game i want the game to generate a random number 0 or 1 for who can play first. That part i have. But now i want to import that variable into another method and work with that if it makes sense.

To clarify :

In "world" i have a method that generates a random number. say : PlayerTurnFirst (variable)

in "cube1" i have a method with an if/else statement saying if "PlayerTurnFirst" is 1, then setText to X .. else if "PlayerTurnfirst" is 0, setText to O.

But i just can't seem to get that "PlayerTurnFirst" variable that i created in the world into the cube method.

So does anyone know how to make that variable accesable in every method ?

Thanks in advance !

(Sorry if my English is a bit off)
   
Reply With Quote