Hey. I'm trying to make it so when my program starts levelnum is set to 1 (levelnum = 1;) and later in the program it changes to 2(levelnum = 2;) but it wont change. I've tried everything I can think of but it doesn't work.. help?
Printable View
Hey. I'm trying to make it so when my program starts levelnum is set to 1 (levelnum = 1;) and later in the program it changes to 2(levelnum = 2;) but it wont change. I've tried everything I can think of but it doesn't work.. help?
Can you show your code?
You don't do this, right?
:)Code:while(Looping)
{
LevelNum = 1;
... //The rest of the code
LevelNum = 2;
}
Other than that, it is hard to guess without some source.
or perhaps levelnum is a const.
Are you running into a 'scope' issue, i.e. changing 'levelnum' in a function after declaring it elsewhere, like main()?
Easy to throw some "test code" in after assigning 'levelnum = 2;'. If the assignment is inside of a 'block', or function, make sure your test code is outside of it. ;)
Actually, alpha, Salem and Magos all have excellent suggestions. Check the "obvious" first before making this harder than it may be.
-Skipper
Not sure if I did anything at all but I re-compiled it and it worked fine. Anyways, thanks for the help.