A flag is basically some variable, usually an integer or a boolean. that's used to keep track of the status of something you're trying to.... well, keep track of. Let's say you want to use the space bar to toggle when something moves. The object is at rest. You hit the space bar and it begins to move. You hit the space bar again and it stops. I'm going to use pseudo code here since I don't have time to construct a full example.
bool ballIsMoving = false; // initialize the flag
.
.
if (spacebarisstruck) { // toggle the ball moving flag
if (ballIsMoving == false) ballIsMoving = true;
else ballIsMoving == true);
}
elswhere in your main loop you should have something like
if (ballIsMoving) {
AdvanceBallPosition();
CheckforBallCollision();
}
Integers can be used to track items that have multiple states, such as a stopped ball, slow ball, fast ball, no ball...., etc.
Lilith, Night Butterfly
I'm not a programmer but I play one in the office