Welcome to WebmasterWorld Guest from 54.196.238.210

Forum Moderators: open

Message Too Old, No Replies

Problem with an if statement.

I am having a problem with a variable in an if statement.

     

MartinWeb

12:10 am on May 17, 2009 (gmt 0)

5+ Year Member



I am currently trying to make a game that involves many spaces for the pieces to go on. I keep track of what piece is on each square with the use of many variables. So, for example, the first square has an attached variable called "s1", the second square has an attached variable called "s2", and so on. I tried to run the following code, to make the pieces move-

var op = 6; //This is just an example, this would actually be based on the piece that is clicked on.

if(_root.s&var(op)=='0'){ //if nothing is on it
_root.move.gotoAndPlay(op);
}

I continuously get error messages involving the if statement. I want it to turn into, " if(_root.s6=='0'){".

Do you know how to fix this?

Please help!

Thanks!

 

Featured Threads

Hot Threads This Week

Hot Threads This Month